Today state lotteries are a thriving industry, with Americans spending more than $100 billion each year on tickets. But they have a long and sometimes rocky history. Here are three things to know about them.

The earliest recorded lotteries date back to the 15th century, when a number of towns in the Low Countries held public lotteries to raise money for town fortifications and to help the poor. By the 1740s, American colonists were using them to finance roads, churches, libraries, canals, schools, and colleges. In fact, Denmark Vesey used the lottery to win his freedom from slavery in Charleston, South Carolina, in 1800.

While the popularity of lotteries rose in the 1980s, their success was not a foregone conclusion. It’s likely that the growth in popularity was driven by broader economic inequality, newfound materialism that asserted anyone could get rich if they only tried hard enough, and popular anti-tax movements that led lawmakers to seek out alternatives to raising taxes, including lotteries.

In addition to these factors, the growing size of jackpots was fueled by the increase in the average ticket price and a rise in advertising costs that often exceed 80% of the prize pool. Critics argue that lottery ads are often misleading, offering false information about odds of winning, inflating the value of prizes (which are paid in equal annual installments over 20 years, with inflation and taxes dramatically eroding the actual amount), and so on.

It’s also worth noting that the vast majority of lottery players are from middle-income neighborhoods, and far fewer people play from low-income areas. While it’s possible that those from poorer neighborhoods may feel less pressure to gamble because they have more financial options, the reality is that most people who play the lottery do so with the hope of achieving wealth by any means necessary.