Katherine Braun sorts packages toward the right shipping area at an Amazon.com fulfillment center in Goodyear, Ariz. Products are flying off the shelves at Amazon warehouses across the county as Californians prepare to start paying sales taxes on online purchases. (ASSOCIATED PRESS / Ross D. Franklin, file)

SACRAMENTO, Calif. (AP) — Online retailer Amazon.com has tried to become all things to all consumers, but in California, it is about to take on a role it has fought against for years: tax collector.

The change, which takes effect this weekend, comes after years of bitter back and forth between the world’s largest online mall and the California Legislature over whether Internet retailers should have to charge sales tax. The two sides reached a deal in 2011 that included a one-year grace period set to end Saturday.

The deadline has spurred at least some consumers into impulse-buying mode, making big-ticket purchases and stocking up on essentials before the tax collection kicks in.

“Even the mailroom is laughing at me,” said Derek Daniels, 37, who has had Amazon packages delivered to his Los Angeles office every day this week. He’s loading up on household supplies like trash bags and collecting birthday and Christmas presents for his Superman-loving 2 year-old.

“We are hoping he won’t fall in love with Batman by the time November rolls around,” Daniels said.

The looming deadline prompted San Diego artist John Purlia to finally buy that Samsung flat-screen television that had been sitting in his Amazon shopping cart for months. He also picked up four CDs, an external hard drive and an oddly decorated $17.99 kitchen cutting-board — a gag gift for his sister.

“The TV was the motivating factor and the other stuff came along for the ride,” said Purlia, 52. “I know I’m going to be back at Amazon before Saturday looking to take advantage of this. It’s like the final days of a sale.”

Technically, Purlia and Daniels owe taxes on all of this: California residents are supposed to calculate their obligation and send it directly to the state. But fewer than 1 percent do, according to the Franchise Tax Board.

Lawmakers have long complained that the increasingly popular e-retailer was depriving the state of millions of dollars by refusing to charge taxes at checkout. But Amazon said it was shielded by a 1992 U.S. Supreme Court ruling that prohibits states from forcing businesses without a physical presence in the area to collect sales tax.

The e-commerce giant said it did not have a physical presence in California because it does not have warehouses or other buildings here.

Similar fights have played out in other states, with Amazon sometimes shuttering distribution centers and canceling contracts to be able to continue selling tax-free goods.

Now Amazon is making treaties across the country, paving the way to start opening warehouses and offering faster shipping in areas where tax disputes had previously prevented it from putting down roots. The company now collects sales taxes on orders shipped to seven states, including New York and Texas, and has agreed to start imposing levies in six more.

The resolution of Amazon’s tax fight in California has allowed the company to start building a network of distribution centers. Soon, customers in the nation’s most populous state will receive shipments from warehouses in San Bernardino, which is near Los Angeles, and Patterson, near the San Francisco Bay Area — instead of from Reno, Nev. or Phoenix. Each new center is expected to bring hundreds of jobs to California, where the unemployment rate is the third highest in the nation.

The new warehouses will shrink delivery times and may one day enable Amazon to offer some customers here same-day shipping, as it does in 10 U.S. cities, including Boston and Seattle.

That is the Holy Grail for hardcore online shoppers like San Francisco product manager Reid Butler.

“For me, most my friends and family, same-day delivery could be a big blow to our retailers down the street,” said Butler, 32.

As the tax deadline nears, Butler is stocking up on enough soap, printer ink and baby formula to last until the day he can scan a barcode in the morning and receive his toilet paper that afternoon.

The brick-and-mortar stores that pushed for the “Amazon tax” to level the business playing field hope the changes will end the dispiriting practice of “showrooming,” when people browse electronics or books in a store but make their purchases online.

“It will remove one incentive for not buying local,” California Retailers Association president Bill Dombrowski said. “Retailers are looking forward to it, but we don’t go out and buy champagne on September 15.”

Colin Sebastian, an analyst with Baird Equity Research, predicts Amazon will be able to make up for the loss in sales tax advantage by carpeting the state with distribution centers.

“The irony in this is the closer Amazon gets to its customers, the more success it seems to have,” he said.

Amazon spokesman Scott Stanzel said the company will continue to offer lower prices, even without the sales tax advantage, and is not worried about losing business. He would not say whether the tax deadline has affected sales.

More change may be on the way. Amazon is lobbying Congress to cut through the web of state-specific rules and devise a national policy for Internet taxation.

Sales tax rates in California reach 9.75 percent and are among the highest in the country. The new rules, which may affect more than 200 out-of-state businesses, are expected to bring in more than $200 million annually, with at least $80 million coming from Amazon alone.

California’s tax authority is preparing to hire 30 specialists to make sure the state collects the revenue it is due. Jerome Horton, chairman of the state Board of Equalization, said the change will allow out of state companies to “contribute their fair share” toward schools and other public services.

Amazon has been tax-free for nearly two decades; an adult lifetime for some customers.

Amateur photographer Joe Chin, 27, saved more than a hundred dollars last week when he used Amazon to buy a $1,400 Fujifilm digital camera. A world without tax-free shopping will be an adjustment, he said.

“It’s kind of like going back to how it was when I was a kid,” he said.