It all depends on why you buy the ticket. If you buy the ticket in order to win the lottery, you are setting yourself up for disappointment. If you buy the ticket so you can spend the next few days fantasizing about what you will do after you win the lottery, then it can be a surprisingly affordable form of entertainment.
You can look at fancy homes on the internet, check out fancy cars and restaurants, and daydream and imagine with something “real” in your pocket. Of course, like Schrodinger’s cat, you eventually have to check to see if it a winning ticket (and it won’t be). But hey, they are cheap enough, and most people spend more on coffee each week.