Is it okay to buy a lottery ticket? I know we are not supposed to gamble.
The Church does not forbid gambling, so long as it is done responsibly and the money used for gambling is not needed for other legitimate obligations. The Catechism of the Catholic Churchstates:
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. (CCC 2413)