Whether they take the form of cash, miles or points, credit card rewards have become a staple of U.S. consumer culture. Many households, particularly at the upper end of the income spectrum, charge just about every purchase, mainly so they can collect rewards with each swipe.

Between 2010 and 2016, the nation’s six largest card issuers more than doubled their spending on rewards, according to one study published last year. Many of those perks were funded through increases in the fees that banks and card networks charge to retailers that accept their cards.

On Monday, the U.S. Supreme Court ruled in favor of American Express in a 5-4 decision that enshrines the economic model upon which credit card rewards rely.

The Obama administration and numerous states had sued Amex, arguing that provisions in the company’s contracts with retailers were harmful to competition. Amex’s contracts essentially bar merchants that accept American Express cards from steering consumers to pay with rival cards that charge lower fees.

If the government’s argument had prevailed, retailers that accept American Express but aren’t happy about the fees Amex charges could have encouraged customers to use Visa, Mastercard or Discover, perhaps by posting a sign near the cash register in an effort to influence which card the customer pulls out of the wallet.

But in an opinion written by Justice Clarence Thomas, and joined by the rest of the court’s conservative bloc, the court sided with Amex, and said that the New York-based company can ban steering practices in its contracts with retailers.

The decision is likely a win for consumers who are avid users of credit card rewards programs. But for consumers who typically pay with cash or debit cards, it may be a loss, since merchants contend that they pass along the cost of higher swipe fees to their customers.

The decision is also a setback for retailers, which persuaded Congress to rein in debit card swipe fees in 2010, but have been unable to replicate that success in the credit card market. The ruling’s impact on Discover, Visa and Mastercard, as well as banks that issue credit cards on the latter two networks, is murkier.

While the case involved arcane legal concepts that are the bailiwick of antitrust scholars, the court’s decision relied on a fairly simple idea — that judges need to consider the impact of Amex’s contracts on not only retailers, but also consumers.

“If a merchant accepts the four major credit cards, but a cardholder only uses Visa or Amex, only those two cards can compete for the particular transaction,” Thomas wrote. “Thus, competition cannot be accurately assessed by looking at only one side of the platform in isolation.”

Justice Stephen Breyer wrote a dissenting opinion in which he argued that Amex should be required to compete with other card networks on the price of the fees they charge to merchants.

The government’s lawsuit was filed eight years ago, when the credit card industry was still contending with mountains of consumer debt that went bad during the financial crisis.

The Obama administration initially prevailed in U.S. District Court in February 2015, but that ruling was tossed out by a three-judge panel of the Second Circuit Court of Appeals in September 2016.

After the Trump administration declined to appeal that ruling, 11 states that were co-plaintiffs asked the Supreme Court to hear the suit.

The court’s ruling drew praise from American Express and others in the credit card industry.

“The Supreme Court’s decision is a major victory for consumers and for American Express,” Amex CEO Stephen Squeri said in a written statement. “This was a long battle, but well worth the fight because important issues were at stake: consumer choice, fair market competition, and the ability to deliver innovative products and services to our customers, both consumers and merchants.”

Shares in Amex were up 1.5% in midday trading on Monday, even as the major stock indexes were down by more than 1%. Shares in Visa and Mastercard fell by more than 3%.

Retail industry groups were most critical of the court’s decision, arguing that the fees that merchants pay get passed along to consumers.

“The United States has the highest costs and most fraud-prone payments card market in the world,” Mark Horwedel, CEO of the Merchant Advisory Group, which represents retailers in the payments sphere, said in an email. “By maintaining the status quo, the lack of transparency and competition in the U.S. will lead to higher prices at point of sale.”

Bill Carcache, an analyst at Instinet, argued in a research note that even if the ruling had gone against Amex, merchants likely would have been hesitant to steer customers to a particular credit card for fear of antagonizing shoppers and consequently losing sales. He also stated that the fees charged to merchants when customers pay with American Express are not much higher today than those charged on premium Mastercard and Visa cards.

But others contended that the Amex lawsuit, if it had been decided differently, had the potential to shake up the market for credit card rewards.

“Swipe fees are the engine that powers the whole credit card rewards game,” Matt Schulz, senior industry analyst at CreditCards.com, said in an email. “If those fees had taken a hit, which was a real possibility if the ruling had gone against Amex, it would’ve been great news for merchants’ bottom line but would almost certainly have marked the end of the golden era of credit card rewards.”

