People sometimes describe lotteries as a tax on those who are bad at math. The tickets are worth less than their face value, given the size of the payout and your odds of winning.
That is all true enough. At the same time, it bears remembering that we each get to live a single very finite life. Used well, the winnings from a lottery could improve that one and only life a lot – particularly if the money is used to advance a particular cause that is important to you, rather than used hedonistically.
Losing the cost of a bunch of lottery tickets is irrational if your aim is to maximize how much money you are likely to have in your life. At the same time, betting on a long shot can be rational in the sense that there is a large amount of upside that you have no hope whatsoever of capturing if you do not play.
Expressed another way, the problem with lotteries is that you basically pay $5 for a one-in-a-million shot of winning $1,000,000. The ticket is overpriced and the money is probably wasted. At the same time, there is probably no other way in which you are going to get $1,000,000. At least playing the lottery gives you some chance, however infinitesimal.
The logic is similar to that of buying insurance against your house burning down. If you had a huge number of houses, you would be better off not paying premiums and just dealing with the cost of fires yourself. Because you only have one house, however, you overpay on premiums in order to avoid a catastrophic outcome.
All that said, and as I have argued before, I don’t think lotteries and casinos should be allowed to advertise. It is better for the state to keep gambling legal and regulated, rather than allowing it to become one more racket for organized crime along with drugs and prostitution. At the same time, neither the state nor private companies should be permitted to take advantage of the weak understanding of probability in the general public through advertising a profoundly false promise that winning is likely. Casinos also should not be allowed to serve alcohol.
To sum up, winning the lottery is an extreme long shot, but when you only have a single chance to try something it can be a rational strategy to accept a set risk (the near certainty that the money spent on a ticket is wasted) in exchange for a chance at a large benefit.