Last week's Mega Millions jackpot winner may have been in California, but when it comes to selling the most winning tickets, New York walks away with the top prize.

Residents of the state have won the lottery game's jackpot a whopping 35 times in the last 16 years, ahead of even California, which sold the winning ticket 30 times in its 13 years of participation in the game.

A surprising third? New Jersey.

With one-fourth of the population of California, and one-eighteenth its size, the East Coast state has punched far above its weight in the Mega Millions stakes, selling the winning ticket 20 times since 2002.

California Lottery official Mike Neis, right, watches as Amol Sachdev hangs a sign over his family's store Ernie's Liquors in San Jose, Calif., July 25, 2018. The California Lottery says one lucky person won the Mega Millions lottery. The state lottery's verified Twitter feed says the winning ticket, worth more than $500 million, was sold at Ernie's Liquors.(Jeff Chiu/AP) California Lottery official Mike Neis, right, watches as Amol Sachdev hangs a sign over his family's store Ernie's Liquors in San Jose, Calif., July 25, 2018. The California Lottery says one lucky person won the Mega Millions lottery. The state lottery's verified Twitter feed says the winning ticket, worth more than $500 million, was sold at Ernie's Liquors.

To Victor Matheson, a professor of economics at the College of the Holy Cross, though, New Jersey's successful run isn't really that surprising. He said the reason lies in the history of the game.

"In the beginning, Mega Millions was not adopted nationwide by all states," Matheson said. "For roughly the first 20 years of the big multi-state lotteries, America actually had two separate lotteries -- one, the Powerball, the other, Mega Millions, and the two were run by totally separate organizations and weren't allowed to sell tickets in the same states. And then there were some states that weren't part of either organization."

Two of New Jersey's neighboring states, Pennsylvania and Delaware, didn't join the Mega Millions member states until January 2010, when the two lotteries agreed on a merger and 23 additional state lotteries joined them. So residents in the two states turned to their neighbor instead.

"New Jersey got a lot of wins back in the old days when you could only buy one type of multi-state lottery ticket in each state," said Matheson. "It was the place that huge numbers of people would come across the border and buy a Mega Millions ticket even if they couldn't buy that ticket in their own state."

Mega Millions Lottery forms are pictured at Ted's State Line Mobil in Methuen, Mass., July 24, 2018. Ted's State Line Mobil has the highest payout of all lottery sales points in the Commonwealth of Massachusetts.(CJ Gunther/EPA/REX/Shutterstock) Mega Millions Lottery forms are pictured at Ted's State Line Mobil in Methuen, Mass., July 24, 2018. Ted's State Line Mobil has the highest payout of all lottery sales points in the Commonwealth of Massachusetts.

Fifteen of the 20 times New Jersey has sold the winning ticket since 2002 were before 2010.

Matheson said there are other factors that tilt the jackpot scale towards states like California, New York and New Jersey.

"We find people somewhat more likely to buy lottery tickets in places that are fairly urban," Matheson said. "And I imagine the reason for that is it's just more sales opportunities. If you're a farmer way out in rural Nebraska you may not have as many opportunities to go into the convenience store to buy tickets."

The second factor that affects the number of lottery jackpot wins, Matheson said, is religion.

"Places that are particularly conservative religiously tend to not have lotteries and Utah is one example," he said. "It's probably the most conservative state in the United States in terms of religion. And they don't have a lottery at all."

There are currently six states that don't participate in the Mega Millions: Alabama, Alaska, Hawaii, Mississippi, Nevada, and Utah.