Lottery tickets are not a good investment for those who seek to maximize expected value, as the risk of losing is high. However, decision models based on utility functions defined by things other than the lottery outcomes can account for the purchase of tickets.
Some people play the lottery on a regular basis, and they may have “quote-unquote” systems for choosing their numbers, times of day to buy, etc. They may believe they have a certain amount of skill in picking their numbers, and that the odds are fair.
Lottery players may also think the money they win supports their state, and that the state is using it to do something good in society. But when you look at the size of the jackpots versus overall state revenue, you can see that winning the lottery is not a particularly effective way for governments to raise money. Moreover, winning the lottery can have significant adverse consequences for the health and quality of life of those who do so.