The days shopping tax-free with Amazon are coming to an end.

On Saturday Amazon (AMZN) will start collecting sales taxes on purchases in the last four states where it wasn't doing so: Hawaii, Idaho, Maine and New Mexico. Four other states -- Delaware, Montana, New Hampshire and Oregon -- have no sales tax, while a fifth, Alaska, doesn't have a statewide tax, but it does have municipal sales taxes.

Typically, an online retailer only has to collect sales tax in states where they have a physical presence, such as a storefront or a distribution center. That loophole cost states $17.2 billion in lost sales taxes last year, according to the National Conference of State Legislatures.

Related: Jeff Bezos tests giant robot suit

"The way we are consuming things is so different. Because of that, the states' sales tax revenue is not keeping pace," said Max Behlke, director of budget and tax policy for the NCSL. "States have to modernize [sales taxes] to the 21st century. If they can't collect sales taxes, it'll mean higher state income taxes or property taxes."

Embattled brick-and-mortar retailers have long complained about what they argue is the unfair advantage held by their online rivals. But various bills to require online retailers to collect all the different sales taxes have stalled in Congress, despite bipartisan support.

For years Amazon was one of the leaders in the fight to keep online purchases tax free. But as it has moved to offer faster and faster deliveries, it has expanded its network of distribution centers and started collecting sales taxes in more and more states.

"Their business model has changed. To have same day or next day delivery, you need distribution centers nearby," said Behlke.

By the end of last year, Amazon was collecting sales taxes in 29 states and Washington D.C. Since that list included all of the largest states, that meant it was effectively collecting sales tax from 86% of the nation's population. The site has been rapidly adding the remaining states to the list of places where it collects taxes this year, bringing the total to 41 states plus Washington. And as of April 1, it will collect from all 45 states that have a statewide sales tax.

Related: There's a bubble in brick-and-mortar stores, and it's bursting

Amazon did not respond to a request for comment on the change in policy.

And there is still one big sales-tax loophole left on Amazon: Shoppers don't have to pay sales tax when they buy from one of the site's many third-party vendors.

Those vendors have huge sales in their own right. Amazon says it has more than 100,000 vendors who sell more than $100,000 each annually, which means total sales of more than $10 billion. Amazon says that nearly half the items it sells are from third-party vendors.

"Whatever a state is getting in sales tax from Amazon, it should probably be getting about twice that much," said Behlke.