A competition based on chance in which numbered tickets are sold and prizes are awarded to the winners. Often used as a means of raising funds for public or charitable purposes.

Some governments outlaw lotteries, while others endorse them to the extent of regulating their sale and organization. Regardless of their legal status, lotteries are considered a form of gambling and can be a risky way to win money.

The first recorded lottery-type games were in the 15th century, when towns in Burgundy and Flanders used them to raise funds for town fortifications and to help the poor. Lotteries were popular throughout Europe until the 1800s, when religious and moral sensibilities shifted attitudes toward all forms of gambling, Matheson says. Corruption also turned people against them.

In the colonial period, lotteries helped finance canals, roads, churches, colleges and even wars. The foundations of Princeton and Columbia Universities were financed by lotteries, as were many of the American colonies’ fortifications during the French and Indian War. Lotteries were also the source of funds for the British Museum and the repair of many bridges. The enslaved Denmark Vesey won a lottery prize in Charleston, South Carolina, and used the money to buy his freedom in 1822.

Now, most state governments run lotteries. And while the prize amounts vary, they are usually in the range of thousands of dollars or more. They are a popular and often profitable way for states to raise money. But there are questions about how these games affect the overall financial health of society and whether they can actually provide a better return on investment than more traditional investments.

Some states have tried to reduce the societal impact of lottery games by limiting how much people can play or by using other measures, such as imposing age restrictions and prohibiting purchase of tickets by minors. But it’s unclear whether these changes can be effective, especially given the large popularity of the games.

One thing is clear: Most lottery players don’t take their chances lightly. I’ve talked to gamblers who spend $50 or $100 a week, people who have been playing for years. They know the odds are bad, but they still play. There’s this inextricable human impulse to gamble.

Those who do win the lottery should work with professionals, such as an attorney, accountant and financial planner, to consider their options and make wise decisions. They will need to weigh payout options, such as annuity versus cash and how to best protect their privacy. They will also need to determine how much debt they can afford to carry and how much of their new wealth they want to give away.

Keeping names private is also important, to avoid the temptations of long-lost friends and family who are eager to get their hands on some of the winnings. Then there is the matter of how to handle taxes. The good news is that there are a variety of options available to those who win the lottery, including tax-free payments.