People gamble or play the lottery with the idea that there is a chance of getting rich quickly. There is also a high chance of losing your funds from both the lottery and gambling. Buying lottery tickets is a solitary activity where players hope to overcome the odds and change their lives. Another similarity is that most lottery tickets do not win money but there are some that can win $2-5. So players get excited and think they have a real chance of winning the jackpot. This experience is similar to winning a few credits on a slot machine. In both cases there is an incentive to keep playing.
It doesn't hurt to try, what people shouldn't do is depending too much on things that are based on prediction, which is far from reality, as the chances that they will fail iss very high, it's safer to rely on your daily job than some lottery tickets but it doesn't hurt to try, just do it in a responsible way that won't ruin your life.
I don't buy lottery tickets but am into something similar apart from gambling, I am talking about Bitcoin solo mining, using small Asic miners, this is how I choose to play my own lottery game, and I don't have to spend every day to buy a ticket, it's a kind of money you spent just once and that's all, but solo miner and connect to solo pool, if you are lucky you win 3 BTC per block which is consider life changing to me.