Playing the lottery must be an action that has a negative expected value (otherwise they’d go out of business). But if, rather than expected value, you are optimizing for “probability of having a hundred million dollars” or whatever, your options are: keep the money you would have spent on the ticket (0% chance of success) or buy the ticket (very small chance of success).
So, I can see why people go for it. Especially if the ticket cost won’t make an actual difference to their life circumstances, and the winning money would.
But what I can't stand is the self perceived moral superiority of people who are like "haha, lottery is for idiots!"