People watch coverage of the NCAA college basketball tournament at the Westgate SuperBook on March 15 in Las Vegas. Several states are expected to allow sports gaming after Monday's Supreme Court ruling. // AP, John Locher

Now that the Supreme Court says it's OK, states are free to legalize betting on sports if they want to. As a once under-the-table economy moves into the open, it creates some large business opportunities — and the potential for millions in new tax revenues.

But first comes the nitty-gritty part: writing the rules for how sports fans can bet on their favorite games — the legal age, where people can bet, licensing requirements, software standards for mobile apps, and money laundering safeguards.

"We also have to establish what the tax structure will be," says New Jersey Assemblyman John Burzichelli. "That's very important. We're actually in our budget cycle now."

He says the tax rate is still being negotiated, but will be between 8 percent and 15 percent of revenue after winnings are paid out. He says New Jersey can get these rules written in about four weeks.

This puts the state neck and neck with Delaware and Mississippi. Close behind them — and just in time for football season — are Pennsylvania, West Virginia and Connecticut. These are all states with an established gaming industry, all trying to be the first to take legal sports bets.

"Markets of this size don't just come into being on a regular basis," says Chris Grove, a gaming analyst for the research firm Eilers & Krejcik.

He expects 32 states to eventually allow sports gaming, worth roughly $6 billion annually. But, he says, that may not come so easily.

"There's an existing black market. It's entrenched. It's attractive. It offers a number of advantages that regulated betting sites will never be able to offer: the lack of having to fill out tax forms and have your winnings reported, the ability to bet on credit," Grove says.

But new entrants into the gaming industry don't expect much competition from the black market.

"I think most people would prefer to do things in a legal manner if given the option," says Jason Robins, CEO of the daily fantasy sports company DraftKings.

He compares illegal sports betting to the pirating of music. Most people shifted to legal products when streaming services came along. He contends something similar will happen in sports gambling.

Some analysts warn that profit margins might not be as plush as investors hope. A lot depends on how heavily sports betting is taxed.

And on top of taxes, there's what professional sport leagues want.

After years of fighting against sports betting, the NFL, Major League Baseball and other leagues have changed their approach. Over the last few months they've been going state to state, lobbying aggressively for a special fee to pay for policing against cheating, like an athlete intentionally throwing a game.

In New Jersey, leagues tried to get a fee between 2 percent and 3 percent of gross wagers. But lawmakers balked.

"They're not paying that in Nevada and their not paying that to the illegal sportsbooks." Burzichelli says. "That's a nonstarter as far as I'm concerned."

In statements Monday, the major sport leagues said they will be looking to Congress for a "regulatory framework" to protect the "integrity" of their games.

U.S. Rep. Frank Pallone of New Jersey is sponsoring one bill, which would establish a legal framework for consumer protections and give the Federal Trade Commission some oversight. But he acknowledges it's not getting passed anytime soon.