When the jackpot is big enough, the odds discounted value of the ticket exceeds the purchase price.
It’s like flipping coins when you pay $1 for a 50/50 chance to win $3.
And that's the root of most of these hard-luck stories with lottery winners. You CANNOT use your money to make friends and family happy. It is a losing battle. You give a little bit to one family member to help them out of a bind and others are going to demand "their fair share." The more money you hand out, the more of your friends and family will feel slighted and accuse you of favoring others more than them. You handing them free money will not fix their problems - rather it will reinforce their bad habits and give them an appetite that requires ever increasing sums of money.
It will never end until you either run out of money or fall victim to some sort of misadventure, likely brought about by a jealous family member or friend.
Best bet is to take a hard line from the start and tell our friends and family "No handouts. Period." And be sure you stick to it. Then hire an accountant you can trust and invest the bulk of your money where the principal is tied up and you have no easy access to it yourself. If your winnings are large enough, you can live a comfortable lifestyle on the interest while protecting and even growing the principal.
You also may need to move elsewhere and only stay in contact with friends and family that you trust.
A lot of bankrupt former professional athletes started out thinking the same thing.