Some casino companies may have hit the jackpot, thanks to a recent landmark decision on sports betting by the US Supreme Court.

The court invalidated a 26-year-old federal law that had banned most sports betting nationwide (except in ­Nevada), essentially leaving it up to each state to decide whether to legalize it.

Over the next five years, 15 to 20 states likely will permit sports betting. That could translate into several billion dollars in additional annual revenue for the casino industry—and a windfall for investors in certain casino stocks.

What not to bet on: Don’t count on casino companies that find most of their revenue in Las Vegas and overseas, such as Las Vegas Sands and Wynn Resorts, to profit much from the court decision. Sports betting already was allowed at most of their properties.

The biggest impact will be on companies that have a strong presence in states likely to be among the first to start taking bets, including Mississippi, New Jersey and Pennsylvania.

Casinos make money on sports betting either by acting as bookmakers themselves and collecting commissions on losing bets or by leasing out space to specialist bookmakers and taking a percentage of their profits. Either way, sports betting also helps drive more traffic to casino hotels and restaurants.

Regional gaming companies most likely to benefit…

Caesars Entertainment (CZR) has 47 casinos in 13 states and five other countries under brands including Caesars, Harrah’s and Horseshoe. The company emerged from bankruptcy proceedings in October and has the most cheaply valued stock of major gaming companies.

Penn National Gaming (PENN), which owns 29 casinos and racetracks in 16 states, has announced a merger with a competitor, Pinnacle Entertainment, which has 16 casinos in 10 states.