Reacting swiftly to an online sales tax signed into law Wednesday by Gov. Jerry Brown, Amazon.com and Overstock.com announced they are severing their relationships with California affiliates to avoid having to collect the tax.

Under federal law, states can require online retailers to collect sales taxes only if the seller has a physical presence in the state. California law requires residents to pay taxes on all online purchases, but many consumers don’t, giving Amazon and other online retailers that don’t collect the sales taxes an advantage over big-box retailers and other brick-and-mortar stores.

The new law allows the state’s tax board to collect sales tax from online retailers that have relationships with an affiliate — typically in-state blogs that drive sales to the retailers in exchange for a small cut of the proceeds.

Supporters say the legislation is long overdue and levels the playing field.

“In California, out-of-state online retailers basically had a 10 percent price advantage every day of the year,” said Bill Dombrowski, a spokesman for the California Retailers Association, which lobbied for the legislation. “This is nothing more than some companies trying to get a competitive advantage through a tax loophole, and now we have closed it.”

It remains far from clear, however, that the law will succeed in forcing Amazon and other online retailers to collect the sales taxes. When other states — including Illinois, Arkansas and Connecticut — passed similar online sales tax legislation this year, Amazon severed its ties with affiliates in those states as well. Amazon is challenging a similar New York law in court, so the issue of how far states can go in their efforts to collect online sales taxes may ultimately be headed for the U.S. Supreme Court.

Even cutting ties with affiliates, however, might not be enough for retailers such as Amazon. The law has a second provision that would force retailers with a subsidiary based in California to collect the tax. Amazon has several, including Lab126 in Cupertino, which develops Kindle book readers for the company.

Diana Tucker, owner of West Valley Music in Mountain View, said her shop struggles to compete against Amazon and other online retailers that don’t collect sales tax.

“We still have enough people who think a music store is pretty cool to be around, but we have lost seven or eight music stores in the Bay Area in the last five years,” Tucker said. “People think they are getting a deal by ordering their stuff online and out of state, but, in fact, they are hurting the schools, the police.”

The State Board of Equalization estimates there are 25,000 affiliates in California, 10,000 of whom make money by being affiliates with Amazon.

“We oppose this bill because it is unconstitutional and counterproductive,” Amazon said in an email to its affiliates. “It is supported by big-box retailers, most of which are based outside California, that seek to harm the affiliate advertising programs of their competitors.”

Utah-based Overstock.com, which did $1 billion in online business last year, sent a similar note to its California affiliates Wednesday.

“We think this law is unconstitutional,” said Mark Griffin, Overstock’s general counsel. “We sent a final note to our California affiliates today. It’s a business decision that we had to make.”

Ken Rockwell, a La Jolla resident who writes a popular blog about cameras and photography, earns most of his income by being an affiliate. His blog links to retailers like Amazon and B&H Photo-Video, which has a large retail store in New York as well as a robust online sales operation. He’s still trying to understand the impact of the law, but assumes that he’ll no longer earn money from Amazon.

“This is not good for anybody, and it affects the companies who pay me,” said Rockwell, 49, who has blogged about photography full time for 10 years. “It seems like the government is messing with something that it really doesn’t understand. A lot of people make a few dollars here and there by being affiliates, and they really need the money.”

Staff writer Troy Wolverton and the Los Angeles Times contributed to this report. Contact Dana Hull at 408-920-2706. Follow her at Twitter.com/danahull.