When Amazon agreed last year to begin collecting sales tax in New Mexico, state officials celebrated what they said could be tens of millions of dollars in annual tax revenue.

But they aren't cheering in Albuquerque City Hall. A year after that announcement, New Mexico's largest city hasn't seen a dime from Amazon. That's because the online shopping giant's deal applied only to the 5.125 percent statewide tax, not to the 2.375 percent tax tacked on by the City of Albuquerque.

''The loser in that arrangement is cities,'' Mayor Tim Keller said. ''Cities are really being left to themselves.''

Thanks in part to a series of deals with state governments in recent years, Amazon is collecting sales tax in every state that has one. But those deals don't always extend to taxes assessed by local governments. The company still isn't collecting sales taxes in dozens of cities, including Philadelphia, Pittsburgh and Cedar Rapids, Iowa, according to a new report from the Institute on Taxation and Economic Policy, a left-leaning think tank.

Carl Davis, the report's author, said local governments were missing out on millions in tax revenue when other income streams are also under strain. And local retailers, many already struggling to compete with online retailers, are effectively forced to charge more for their products than online sellers that aren't required to collect local taxes.

''It's just a direct price advantage that shows up on customers' receipts,'' Mr. Davis said. ''You never want to end up in the situation where the companies you're offering better deals to are the ones that don't even have roots in your community.''

More from The New York Times:

Apple goes to Hollywood. Will its story have a happy ending?

Uber to sell its Southeast Asia business to Grab, a regional rival

Timeline: Facebook and Google under regulators' glare

Amazon says it collects taxes in every jurisdiction where it is required to do so, and Mr. Davis's report found that the company does collect local taxes in most states. But a hodgepodge of state laws govern tax collection, meaning there isn't a simple solution for municipalities that are now left out.

For example, sales tax rules based on the location of the seller may be impossible to enforce if the company has no physical presence in that jurisdiction. And smaller online retailers can escape collecting sales taxes in more places than Amazon does -- even when they use Amazon to sell their products.

Amazon is facing increasing scrutiny over its tax policies. Despite being one of the largest retailers in the country by revenue, Amazon pays relatively little in federal income tax, largely because of its low profit margins. Until several years ago, Amazon also collected little in state sales taxes, and in most states still does not collect taxes on goods sold on its platform by third parties. (Amazon collects taxes on such third-party sales in Washington State, and agreed this month to begin doing so in Pennsylvania.) The company has also faced criticism for requesting tax incentives from state and local governments to lure Amazon facilities, including its planned second headquarters.

Mr. Davis, however, said his findings were less the fault of Amazon than of state tax systems that don't require, and in some cases don't allow, online retailers to collect local taxes. He said states rushed to strike deals with Amazon without always ensuring that local governments would benefit as well.

''It's just been overshadowed by the state issue,'' Mr. Davis said. ''It's smaller dollars at play, but for these communities, it's dollars that matter.''

Amazon sometimes collects taxes where other online retailers do not. In Chicago, for example, Amazon collects local taxes because it has warehouses and other facilities in Illinois; online retailers that don't have a physical presence in the state generally don't have to collect taxes there.

Usually it is states -- not cities or counties -- that decide who has to collect local sales taxes. In most states, taxes are based on the location of the buyer, and retailers are required to collect local sales taxes alongside state taxes. But in some states, including New Mexico, taxes are based on the location of the seller, meaning there is no mechanism for collecting taxes from sellers that don't have a physical presence in the area. Other states have other legal quirks that affect local tax collections.

Those loopholes have existed for years, but their significance has grown greatly with the rise of online retail, said Scott Peterson, vice president of government relations as Avalara, a company that helps retailers calculate and collect sales taxes.

''This huge hole that exists in the sales tax structure has been known for a long time,'' Mr. Peterson said. ''Their laws have not kept up.''

A pending Supreme Court case, South Dakota v. Wayfair Inc., could change the legal landscape, but not necessarily simplify it. Depending on the outcome, the case could pave the way for states to require companies to collect sales taxes even if they don't have a location in the state. But local governments in Pennsylvania, New Mexico and other states still wouldn't be able to collect taxes without help from their legislatures.

Local government officials in many parts of the country say the rise of tax-free online shopping has had a big impact on their budgets. Albuquerque, for example, relies on the sales tax -- or what is known in New Mexico as a gross receipts tax -- for nearly two-thirds of its general fund revenue, which totaled about $500 million last year. The city's finance department estimates that it lost out on $5 million in tax revenue on Amazon purchases in 2016, although calculations are difficult because of a lack of available data. Lost revenue from other online retailers adds millions of dollars more.

Mr. Keller, the mayor, said Amazon benefited from city services, such as the roads used by delivery trucks carrying its packages and the police officers who makes sure packages aren't stolen. But unlike local retailers, the company doesn't chip in.

''This is the fundamental way we fund American society, and thanks to technology they found a way to opt out of that,'' Mr. Keller said. ''They're getting a free ride.''

For businesses, the practical effect of that free ride is probably small, at least outside of a handful of high-tax jurisdictions. Local sales taxes add just 1 or 2 percent to prices in most cities, not enough to sway most shoppers' decisions. But retailers said the tax was a matter of fairness: Why should local businesses be at a disadvantage, however small, against a much larger, out-of-town rival?

''The 2 percent doesn't drive someone from my place to Amazon, but it doesn't help,'' said Richard de Wyngaert, owner of Head House Books, an independent bookstore in Philadelphia. ''I just feel that if not all businesses, why any business? If we don't all pay taxes, why should any of us? To me, it's ludicrous. There is a social contract with your citizens.''

Candelora Versace, who with her husband runs a custom jewelry shop in Santa Fe, N.M., said that her customers frequently buy gemstones online, then come into the store to have them put into settings. She said that she doubted they were explicitly trying to avoid paying Santa Fe's roughly 3 percent sales, but that regardless of their intent, the effect on the community was the same.

''The roads don't pay themselves. The schools don't fund themselves,'' Ms. Versace said. ''When they don't want to pay the tax, it cheats us. It cheats those of us who live here and have businesses here.''