SACRAMENTO, Calif. – 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 this week.

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.

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. 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.