South Dakota Attorney General Marty Jackley came to the U.S. Supreme Court Tuesday, backed by the attorneys general in 42 other states, on a mission to overturn a 26-year-old decision that prevents states from collecting taxes on online sales.

But the court's nine justices quickly made clear that it would not be an easy sell.

Jackley had barely begun explaining that states were losing massive amounts of money and small businesses were being harmed by the 1992 case Quill Corp. v. North Dakota before Justice Sonia Sotomayor interrupted.

“I'm concerned about the many unanswered questions that overturning precedents will create a massive amount of lawsuits about,” she said.

The Quill decision dealt with taxes collected by mail-order catalog companies before the internet became a feature of American life. The 2016 South Dakota law challenges that ruling by allowing the state to collect a sales tax on internet purchases from remote retailers who have a so-called economic presence in the state, rather than the physical presence required by Quill.

Most states already require purchasers in their state to pay the equivalent of a sales tax, but, in practical terms, most buyers never do. South Dakota and other states want the ability to have the online retailer collect the sales tax instead.

The justices spent much of the hour-long arguments focusing on the practical fallout for suddenly allowing states to impose online sales taxes. In particular, they worried that the new tax scheme would harm small businesses that sell goods on the internet.

They also raised concerns about whether states other than South Dakota would try to retroactively charge online retailers for the sales tax they didn’t impose in the past. Jackley said that 38 other states (of the 45 with sales taxes) have already asserted that they wouldn’t apply the taxes retroactively.

And several justices wondered whether Congress would be better equipped to deal with the issue, rather than the high court, because the federal lawmakers could better craft a nationwide scheme that would address many of the judges’ lingering concerns.

It is rare -- but not unheard of -- for reviewing courts to reverse their prior decisions. The current challenge to the 1992 Quill decision came about, in large part, because of the high court’s own actions.

Three years ago, the high court considered a challenge to a Colorado law that makes retailers report -- but not collect -- sales tax owed by its residents. Justice Anthony Kennedy wrote a concurrence that invited a challenge to Quill. When the high court decided Quill, he noted, mail-order sales in the country amounted to $180 billion. By 2008, e-commerce sales reached $3.16 trillion.

“Given these changes in technology and consumer sophistication, it is unwise to delay any longer a reconsideration of the court’s holding in Quill. A case questionable even when decided, Quill now harms states to a degree far greater than could have been anticipated earlier,” he wrote.

Less than a year after Kennedy’s comments, South Dakota lawmakers responded by passing a law that they knew would invite an attack from online retailers. South Dakota was far from alone in provoking such an attack, though. Over the past two years, nearly two dozen states have moved to pass bills or change regulations in ways that deliberately invite lawsuits from internet retailers.

By some estimates, states are collectively missing out on more than $23 billion annually in potential online sales tax. A recent study from the Government Accounting Office pegged the annual revenue potential at somewhere between $8.4 billion and $13.5 billion.

The discrepancy is likely because there have been increasing cases where state and local governments are collecting a tax from a remote seller. Notably, Amazon, the largest internet retailer, now has deals in roughly 39 states to remit a sales tax for purchases made through the site.

States have grown bolder, in part, because their efforts to get Congress to act have gone nowhere for more than a decade. The closest they came to a national system for sales tax collection came in 2013 when the U.S. Senate passed the Marketplace Fairness Act. But the bill died in the House, and Congress has not advanced similar legislation since.

The Quill decision would let Congress set a national standard because it is based on the legal theory that states cannot impose greater trade restrictions on products from other states than they do on their own goods. The theory is based on the dormant commerce clause of the U.S. Constitution, which was included so states didn’t start mini-trade wars with each other, as they had when the country was governed by the Articles of Confederation.

So one of the biggest questions in the South Dakota case is whether the requirements for out-of-state vendors to collect sales tax is really creating an uneven playing field for in-state and out-of-state companies.

“Why isn't it -- far from discriminating -- equalizing sellers?” asked Justice Ruth Bader Ginsburg. “Anyone who wants to sell in-state, whether an in-state shop [or] an out-of-state shop, everybody is treated to the same tax collection obligation. All who exploit an in-state market are subject to the in-state tax. Why isn’t that equalizing rather than discriminating?”

Jackley pressed that argument.

“Small businesses are not being treated fairly. We’re not asking remote sellers to do anything that we’re not already asking our small businesses to do in our state. And that is simply to collect and remit a tax,” he said.

But George Isaacson, a lawyer representing Wayfair, one of the companies challenging the South Dakota law, said that remitting sales taxes to all of the country’s jurisdictions would be overly burdensome on out-of-state retailers. The number of jurisdictions that imposed sales taxes has grown from 2,300 when the high court first restricted sales tax collections in 1967, to 6,000 by 1992, to more than 12,000 jurisdictions today.

“Borders count,” he said. “States exercise their sovereignty based upon borders, territorial limits. It’s a key part of horizontal federalism in this country. So, if there's going to be some standard that determines when is a company subject to the tax jurisdiction of a state, using the territorial limits of that state make sense.”

A key factor in the decision is where the justices come down on the question of whether it's better or not to allow Congress to address the question. Ginsburg suggested the court should fix the problem itself. “Why are we asking Congress to overturn our obsolete precedent?”

Kagan, on the other hand, said the solution would be best solved at the U.S. Capitol across the street.

“From this court's perspective, the choice is just binary,” she explained. “You either have the Quill rule or you don't. But Congress is capable of crafting compromises and trying to figure out how to balance the wide range of interests involved here.”

Justice Samuel Alito said giving states a victory in court could prevent the sides from reaching a more comprehensive compromise in Congress.

"As things stand now, it seems that both the states and internet retailers have an incentive to ask for a congressional solution to this problem,” he said. Online retailers would still have to contend with onerous state requirements, like Colorado’s reporting law, while states are trying to collect more of the taxes they’re owed. “There are incentives on both sides. But if Quill is overruled, what incentives do the states have to ask for any kind of congressional legislation?”

The tough questioning isn’t necessarily a bad omen for South Dakota’s chances. Justices often use oral arguments to explore the consequences of the decisions they ultimately make. And it was clear that at least some of the justices were still wrestling with the case.

“When I read your briefs, I thought absolutely right,” Justice Stephen Breyer said. “And then I read through the other briefs, and I thought absolutely right. And you cannot both be absolutely right.”

This appears in the Finance newsletter. Subscribe for free.