The U.S. Supreme Court ruled today that internet retailers, even if they have no physical presence in a state, may be required to collect sales taxes.

The 5-4 ruling, reported in the The New York Times, which overruled a lower court finding in Quill Corporation v. North Dakota, was written by Justice Anthony Kennedy and joined by Justices Clarence Thomas, Ruth Bader Ginsberg, Samuel A. Alito Jr. and Neil Gorsuch.

The New York Times said Kennedy wrote that the lower court decision had caused states to lose annual tax revenues between $8 billion and $33 billion. The lower court ruling “puts both local businesses and many interstate businesses with physical presence at a competitive disadvantage relative to remote sellers,” Kennedy wrote.

The Arkansas legislature failed last year to pass a bill requiring internet retailers with no physical presence in Arkansas to pay state and local taxes. Amazon, however, voluntarily began collecting taxes in Arkansas, and in March, a city of Little Rock filing indicated that Amazon taxes were producing about $1 million a year in sales tax revenue for the city.

The New York Times reported that internet companies took a hit on the markets after the ruling, with shares in Etsy down 4.5 percent and Wayfair down 3.2 percent. Amazon shares were down 1 percent.

Wayfair was mentioned specifically in the court’s ruling. The Times quoted Kennedy’s ruling: “Its advertising seeks to create an image of beautiful, peaceful homes, but it also says that ‘one of the best things about buying through Wayfair is that we do not have to charge sales tax.’ What Wayfair ignores is its subtle offer to assist in tax evasion is that creating a dream home assumes solvent state and local governments.”