Lottery is a gambling game in which people pay a small amount of money for a chance to win large amounts of money. They can either select a group of numbers themselves or allow a machine to randomly spit them out. Most states run public lotteries, but private lottery games are also common and can take many forms. They range from a drawing for units in a subsidized housing project to kindergarten placements at a particular school.

The history of lotteries is long and complicated. Almost every country has had some form of them, although some governments have banned them. In colonial America, Benjamin Franklin ran a lottery to raise funds for cannons to defend Philadelphia from the British, while John Hancock organized one to help build Boston’s Faneuil Hall. George Washington held a lottery to finance a road over the Blue Ridge Mountains, though it failed to generate enough money.

A key reason why lotteries are so popular is that they offer the hope of instant riches, especially in an era of income inequality and limited social mobility. They have a strong appeal to many because of an inextricable human impulse to gamble. This, combined with the belief that everyone should be rich someday, creates a strong sense of meritocratic legitimacy for them.

State government’s dependence on these “painless” revenues is a serious problem, particularly in an anti-tax era. Research shows that lottery play varies by socio-economic group, with men more likely to play than women and blacks and Hispanics less so; playing declines with age, and it is highest among those who are least educated.