score:11
There is no prohibition of it in Canon Law.
St. Thomas Aquinas, in Summa Theologica II-II q. 32 a. 7 ("Whether one may give alms out of ill-gotten goods?"), mentions three ways in which money may be "ill-gotten" (illicite acquisitis), the last being
not because the taking was unlawful, but because it is the outcome of something unlawful, as in the case of a woman's profits from who*edom. This is filthy lucre (turpe lucrum) properly so called, because the practice of who*edom is filthy and against the Law of God, yet the woman does not act unjustly or unlawfully in taking the money. Consequently it is lawful to keep and to give in alms what is thus acquired by an unlawful action.
Similarly with gambling: Although excessive gambling is unlawful, one may justly take the money obtained therefrom.
Thus, even if the money you won by the lottery was ill-gotten, it would still be permitted to give it as alms.
It would be difficult to give a large sum of money anonymously, thus a priest would very likely know the person who gave they money won by the lottery and hopefully make sure that person is not addicted to gambling.
Upvote:7
The Catechism says this about Gambling.
2413 Games of chance (card games, etc.) or wagers are not in themselves contrary to justice. They become morally unacceptable when they deprive someone of what is necessary to provide for his needs and those of others. The passion for gambling risks becoming an enslavement. Unfair wagers and cheating at games constitute grave matter, unless the damage inflicted is so slight that the one who suffers it cannot reasonably consider it significant.
So games of chance such as the Lottery, if done with fairness and nobody suffers, the winnings could be donated to the Church who would use it in one of its many Charities, hospitals, missions, food banks ect.
A person could also use the money for Good purposes without giving it to the Church, directing in a way they feel serves God.