Answer: An almost identical question was asked some time ago.(http://revach.net/ask/archives.php?cid=10&subcat=Tzedaka)
Here's what I wrote then (with a significant additional sentence after the first paragraph):
Answer: With regard to the free gift from a charity organization, it seems to me that one should estimate how much one would have paid for the gift by itself, which one then pays out of one's own pocket, and then the rest can come from ma'aser money. For example if the organization gives a silver cup to anyone who donates $200, and one would pay for such a cup $20, one should give $20 from one's own money, and then one may give the other $180 from ma'aser money.
However, there is room for not making such a deduction, and accepting the gift for free, whilst giving all of the money from ma'aser. This is especially true if the gift is relatively cheap.
One may purchase a lottery ticket from a tzedakkah organisation with ma'aser money. But one should make the following calculation. How much would I have been willing to pay for the ticket had the proceeds not gone to tzedakkah? That amount should come from his own pocket and the remainder may be paid from ma'aser money. For example, if the ticket cost $10, and had the proceeds not gone to tzedakkah he would have been willing to pay $6 for the ticket, he should pay $6 from his own pocket, and may pay the remaining $4 from ma'aser money.
If one wins a prize, one should preferably return to tzedakkah the value of the ticket purchased. As for the rest of the value of the prize, don't forget to take ma'aser from that and give it to tzedakkah!
(R' Moshe Feinstein rules as follows: If there are a fixed number of tickets in the lottery, then there must be a value for each ticket based on the probability of winning, and if the asking price is not much greater than the actual value, such that even one who has no interest in supporting the charity would buy a ticket for that price, one may not purchase the ticket with ma'aser money. If, however, there is no fixed limit to how many tickets will be sold, one cannot fix any value to any single ticket, and thus one may purchase the ticket with ma'aser money.)
If one paid the whole value of the ticket with ma'aser money, and one wins a prize, R' Chaim Kanievsky (Derech Emunah, Matnas Aniyim 7 paragraph "ve'echad me'asarah...") is of the opinion that the entire prize belongs to tzedakkah, as is R' Yisroel Yaakov Fisher (Even Yisrael II 64). However, R' Yaakov Blau (Tzedakkah Umishpot 1:(84)) permits one to pay for the ticket with ma'aser money if one cannot make the above calculation - if one wins a prize, though, one should return the cost of the ticket to tzedakkah as explained above, and tithe the rest of the prize too.