The winners collect from the money wagered by all the bettors. Therefore, it follows that the winners can never collect more than the total amount wagered. The racetrack keeps 10 cents for overhead and profit. Then it places 90 cents into the payoff pool to be shared by the winning tickets. The racetrack doesn't create money, it only takes money.
People enjoy the entertainment.
Also, there is the remote possibility of being one of the few winners at the expense of the losing bettors. So, for most of those attending, they consider their guaranteed losses as payment for entertainment. They are getting entertainment for their money. Again, the government pays the winners from the proceeds of the lottery ticket sales. In both the racetrack and the lottery examples, people are guaranteed to lose part of their original investment.