If you can afford it, then it's no harm really. I've made a profit from the lottery myself, albeit a minor one. Depending on the lottery, it's not the worst thing you can give pocket change away to for a bit of fun. So I never understood this "you'll never win" mentality/gatekeeping hobbies, people know the chances, but it's fun either way.
I think the big problem is that people who are addicted to gambling are being suckered several times a week. It's not really gambling, it's buying a daydream. If a casino gave you similar odds in one of their slots, it would likely be illegal based on the odds and the payout. So people who think of it like gambling are getting the worst of it. The expected value never approaches anything close to fair, even at rhe highest jackpots.
How can you guarantee that? The chance is close to zero, but not zero - ergo you cannot be 100% sure that they won't win.
And that's the point they are trying to make - you don't need to be 100% logical to enjoy life. Sure, they probably won't win. But thinking they might, the anticipation of scratching the tickets, etc, is worth it to them.