Amazon.com Inc. shares slid 1.1% Thursday while bricks-and-mortar store operators rallied, after the Supreme Court ruled that states have the right to collect sales taxes on internet companies that do not have a physical presence in their states.

The 5-4 ruling “would give every retailer the opportunity to compete on a level playing field without government’s thumb on the scale,” said the Retail Industry Leaders Association.

Wayfair Inc. said in a statement that it “already collects and remits sales tax on approximately 80% of our orders in the U.S., a number that continues to grow as we expand our logistics footprint.” The online furniture retailer doesn’t expect the ruling to have a “noticeable impact” on its business.

Amazon AMZN, +1.77% also already collects sales taxes for its own goods in every state that has such a tax, or 45 states or commonwealths, plus the District of Columbia.

The company dropped its long-held resistance to sales tax in recent years, after greatly expanding the number of distribution centers, warehouses and data centers that it operates across the U.S. to speed up delivery times.

But a loophole meant that third-party vendors who sell their products on the Amazon site were not subject to sales tax. It’s not clear whether the new rule will impact such sellers. South Dakota rules require at least $100,000 in annual sales in the state to be taxed.

The Institute for Policy Innovation, a nonprofit think tank that says its approach to governing is one that focuses on the “strengths of individual liberty, limited government and free markets,” is disappointed with the ruling.

“The decision leaves e-commerce and especially small sellers extremely vulnerable to states gluttonous for tax revenue particularly from consumers and businesses with no presence in their state,” Tom Giovanetti, the group’s president, said in a statement.

To protect small businesses, Giovanetti says Congress must now put legislation in place “with a significant small business exemption, a substantial, defensible nexus standard, and a safe harbor for small sellers complying in good faith with the requirements of the law.”

Moody’s said the news was positive for bricks-and-mortar retailers.

“In the case of Amazon, its proprietary sales will be largely unaffected as it is already collecting sales tax in ‘sales tax’ states in which it operates a physical presence, however, the impact on its growing third-party business could be meaningful as, up until now, a chunk of these sales have not been taxed,” said Moody’s lead retail analyst Charlie O’Shea.

Read:These 6 stocks help you build an anti-FAANG portfolio that will beat the ‘Amazon effect’

“As Amazon has continued to thrive despite losing the obvious pricing benefit it used to have from not collecting sales taxes in its proprietary business, it remains to be seen if this new ruling will have any real impact on its third-party sales, or if the convenience for shoppers and growing benefits to Prime members will mitigate the pricing shift,” he said.

S&P Global Ratings said the news is positive for state credit quality, even if the effect is muted in the near-term. The decision “will help stem state tax erosion in a changing economic environment,” S&P said. The ratings agency highlighted 2017 e-commerce sales growth of 15.9% while retail sales outside of e-commerce grew 3.4%. “We expect most states that impose retail sales tax to enact new legislation that require at least large out-of-state online retailers to collect sales tax at time of sale,” said the agency.

Other online retailers also saw their stocks fall. Arts and crafts platform Etsy Inc. shares ETSY, -2.33% were down 3% and eBay Inc. shares EBAY, +1.36% fell 2%. The Amplify Online Retail ETF IBUY, -0.81% was down 0.3%.

Read:Etsy and eBay sellers hold their breath over Supreme Court’s sales tax ruling

Bricks-and-mortar retailers rose across the board on the news. Target Corp. TGT, +0.98% jumped 2.3%, Walmart Inc. WMT, +0.31% was up 0.7%, Dollar General Corp. DG, +0.40% was up 1.1% and Nordstrom Inc. JWN, -2.53% was up 2.1%. Gap Inc. GPS, -1.51% added 1.1% and Kohl’s Corp. KSS, -3.44% was up 1.6%.

Supervalu Inc. US:SVU was up 3%. Kroger Co. KR, +0.27% was up 9% after reporting better-than-expected earnings.

Mall real estate investment trusts were also higher on expectations the stores that they house will be better able to compete with online sellers. Brixmor Property Group Inc. BRX, -0.18% was up about 1%, while CBL & Associates Properties Inc. CBL, -5.26% rose 2.2%.

Amazon shares have gained 48% in 2018, while the SPDR S&P Retail ETF XRT, -1.66% has gained 12.5%.

The S&P 500 index SPX, +0.24% was down 0.5% but has gained 3% in 2018, while the Dow Jones Industrial Average DJIA, -0.00% has fallen 0.9%.