I go to Vegas and gamble sometimes, which is not all that different. I don't gamble because I expect to win money; I gamble because the experience (especially with more social games like craps) is fun to me, even when I lose. Certainly it's not fun to everyone, but roller coasters aren't fun to everyone either, and that's fine.
If you only gamble or play the lottery because you genuinely think you have a reasonable shot of coming out ahead (vs. other uses for that money), then you may have a problem. Or if you have an addiction to gambling and it's actually hurting your finances.
The other bit is that if you're poor, and playing the lottery is a way for you to build a little hope into your life (even if, deep down, you know you're unlikely to win), that's... questionable, maybe? Not an indictment of yourself, but it calls into question societal structures that essentially profit off your low-level financial despair, in return for lessening that despair a little, but only with a placebo. When instead society should instead be helping you, to, y'know, not be poor.
But hey, if someone allocates $5 in their budget to buy scratch-offs every day, I'd say that's probably better for their health than eating a $5 ice cream sundae every day.