An employee of DraftKings, a daily fantasy sports company, walks past screens displaying the company's online system stats in Boston. (Stephan Savoia/AP)

Not so long ago, government officials and police departments around the United States railed against a game that, they said, seemed like harmless fun but was, in reality, gambling in disguise. This game was impoverishing America's youths and seducing them into a lifetime of gambling. Cities around the country declared bans on the game; New York Mayor Fiorello La Guardia even hauled a bunch of them in the streets and hit them with a sledgehammer.

That game was pinball.

Mayor Fiorello La Guardia of New York checks over pinballs and other metal turned over by the police department on Feb. 21, 1942. (AP)

The argument against pinball hinged on one crucial factor: At the time, it was a game of chance, rather than a game of skill. Back then, pinball was much simpler than it is now — there was almost no way to control the ball, so whether you won or lost the game was really up to chance, like spinning a roulette wheel or playing a slot machine. And many machines would reward players who won with some change or more games. So cities around the country declared these pinball machines to be an illegal form of gambling.

Decades later, the distinction between games of chance and games of skill remains a basic legal principle separating legal and illegal betting. In many jurisdictions, if the game involves skill, betting is okay. If the results are just random, then it isn't.

After decades in the dog house, pinball makers succeeded in making the game legal again by making some crucial additions to the game -- namely, flippers to "control" the ball. New York finally made the game legal again after pinball whiz Roger Sharpe gave an amazing demonstration to prove that pinball was a game of skill. He announced to the city council that he would make the ball hit a certain target, and then proceeded to do so.

The distinction between games of chance and games of skill is once again becoming important in the fate of another popular game: daily fantasy sports. These online games, which are regulated at the state level, have drawn new scrutiny after recent scandals in the $492 million industry, including recent allegations of a form of insider trading where employees on one site may have used internal data to win money on another site.

The New York attorney general launched an investigation in early October into two daily fantasy Web sites, DraftKings and FanDuel, where employees may have exploited their access to non-public data to win money. In Massachusetts, the attorney general is talking with daily fantasy sports sites about how to better protect consumers. And Nevada recently ruled that daily fantasy sports betting is a kind of sports pool, and thus must get a license under the state's gambling laws.

In these games, bettors assemble their own team of real-life athletes and then win or lose based on how those athletes perform that day on the field. They differ from other fantasy sports teams, where the players' performance is judged over a week or a season, or tournaments where bettors pick teams instead of players.

Daily fantasy sports is also different from traditional sports betting, mostly because it's a lot more complicated: Instead of simply betting on a team to win, bettors are making dozens of decisions about which players to buy, sell and put on the field. The complex nature of the game is the major reason proponents argue that it is a game of skill, rather than a game of chance.

As states weigh the legality of these sites, they will probably revert to that calculus of whether a game is one of skill or one of chance. Unfortunately, it's not as easy a determination as some might think.

Courts typically see games as arranged on a kind of continuum. On one side are the games of pure chance, like roulette, lotteries, bingo or a coin flip. Strategy has no role in these games, and a player can't intentionally lose them even if he or she would want to. On the other side of the continuum are games of pure skill -- for example, chess, in which all moves are determined by player decisions.

But most games fall somewhere in between, combining player strategies with elements of randomness, like the spin of a wheel, the drawing of a card or the toss of dice. Poker and backgammon both fall in this gray area; some courts have found them to be skill-based games, while others say they are games of chance. Courts have typically found blackjack to be a game of chance, and Scrabble a game of skill.

At least 20 states use something called the "predominant factor test" to decide whether betting on a game is legal, according to Daniel Wallach, a sports and gaming lawyer. If the game is predominantly determined by skill, betting on it is legal. If chance decides who wins and who loses, it is not. In these states, betting on daily fantasy sports, as well as games like pool, darts, card games like gin rummy or mahjong, may be perfectly legal. Other states — such as Arizona and Iowa — use the "any chance test," which bans betting on the game if chance influences the outcome in any way. States in the latter category have typically outlawed daily fantasy sports betting.

On a federal level, Congress has indicated that daily fantasy sports is a game of skill. In 2006, Congress prohibited financial companies from transferring money to online gambling sites. But a provision in the act specified that fantasy sports were games of skill, rather than chance, because they involved decisions about multiple games and multiple players, and thus were exempt from the regulations.

That was targeted at groups of friends or colleagues playing fantasy sports together over a season and came years before the rise of daily fantasy sports betting sites like DraftKings and FanDuel. The Justice Department and the FBI now appear to be examining whether these daily fantasy sites should still qualify. Even if that federal law remains unchanged, however, states can make more stringent laws to regulate daily fantasy sports within their borders.

The daily fantasy sports industry seems to be well aware of the risk and goes to great lengths to emphasize the amount of skill involved. Stars Fantasy League, a fantasy sports technology company, released a study in April that showed that skilled players beat unskilled players nearly 70 percent of the time in weekly fantasy football contests over the 17-week 2014-2015 season. Jason Robins, the chief executive of DraftKings, a fantasy sports Web site, has compared it to playing chess or the stock market. “They do their homework,” he said of daily fantasy players.

Of course, daily fantasy sports also involve a large element of chance -- including, for example, how the weather affects the game, the angle that a ball takes when it bounces off the ground, whether a player gets injured, and whether a coach chooses a strategy that hinges on a certain player. That level of chance appears to be high enough that some state officials, including in Kansas and Florida, have questioned whether the leagues are legal under their current gambling laws.

“There is really little clarity out there on the issue specifically of whether daily fantasy is a game of skill or not,” said Jeff Ifrah, a Washington, D.C.-based gaming attorney.

Daniel Okrent, the man who is credited with first inventing fantasy sports, has said that he considers daily fantasy sports to be gambling. “The distinction people are making … ‘it’s a game of skill.’ Well, poker is a game of skill. Blackjack in a casino is a game of skill. Picking horses is a true game of skill, and nobody would pretend that that’s not gambling,” he told the Boston Globe.

“I’m sure when Congress exempted fantasy sports, they were thinking of 10 guys sitting around a bar and making a bet. They weren’t imagining this," he said.

Some argue that daily fantasy sports is more akin to gambling than weekly or season-long fantasy tournaments, because the short duration of the game raises the influence of chance. This phenomenon is clear in poker, where a new player may have "beginner's luck" and win out over a more experienced player in any given hand.

But over the long run, random good and bad performances tend to get canceled out, and skilled players perform better than unskilled ones. One paper, for example, showed that poker became a game of skill after about 1,500 hands — before that, chance exerted such a strong visible influence that a novice poker player was likely to do as well as an experienced one.

Other economic studies suggest that skill plays a smaller role in some outcomes than people typically assume. For example, we commonly assume that skilled investors do better in the stock market than unskilled ones. However, studies have shown that only a shockingly low number of professional investors are able to outperform the market on a consistent basis.

It may just be human nature to attribute certain accomplishments to skill instead of luck.

Remember Roger Sharpe, the pinball player who demonstrated to the city council with his amazing performance that pinball was a game of skill?  He later admitted that it was just a lucky shot.

Correction: A previous version of this article incorrectly identified Daniel Okrent as Brian Okrent, and said that Roger Sharpe gave the demonstration to a jury, rather than the city council. The post has been updated. 

You might also like: 

The mathematically proven winning strategy for 14 of the most popular games

Researchers have discovered a better way to wait in line, and you’re going to hate it

Oddly captivating photos show what happened to all those Pizza Hut restaurants