Based on a betting game from seventeenth-century Genoa, lotto revolutionized the gambling industry with its staggeringly low odds. Now the most popular lottery games have jackpots in the billions of dollars. But while winning the big prize is a dream come true, many people lose much more than they win. This is because the lottery isn’t just a game of chance—it’s also an intricately designed marketing machine that encourages you to play more and more often, raising stakes and the jackpot size.

To make you think your chances of winning are actually good, the lottery uses tricks like offering prizes for a single number or group of numbers that haven’t appeared before in a drawing to get more people to buy tickets. In addition, the lottery has a system of sales agents who pass money paid for tickets up through the organization until it is “banked.” The money is then used for overhead costs and to fund workers in state offices and to help winners after a draw.

State governments, which have complete control over how they use lottery funds, often direct it toward a specific line item in their budget, such as education or elder care. In fact, some states even hold lotteries to raffle houses and cars on a scale that’s unrivaled anywhere else in the world. Despite their low odds, a win in the lottery can transform your life. But whether you take a lump sum or choose annuity payments, several financial experts recommend investing your winnings in higher-return assets, such as stocks.