Retailers in New Jersey must accept cash as a form of payment after Gov. Phil Murphy signed into law Monday a ban on so-called cashless stores.

With the exception of a few businesses, the new law prohibits most brick-and-mortar retailers from refusing to accept cash. Businesses can be fined up to $2,500 for a first offense and $5,000 for a second violation. Subsequent offenses will be considered unlawful practices under the state’s consumer fraud act, which can levy penalties of up to $20,000.

The governor’s office did not elaborate on why Murphy, a Democrat, signed the legislation. A spokesman did not return a request for comment.

New Jersey lawmakers say the law — applauded by the world’s largest ATM operator — is meant to protect low-income consumers from discrimination. But businesses see the measure as going against a trend toward electronic forms of payment to improve efficiency, reduce the risk of robbery, and greater tax compliance as technology gives consumers more ways to pay, including with their smartphones.

Philadelphia Mayor Jim Kenney signed a similar bill into law in February that takes effect in July. Pennsylvania has an obscure 1983 law that prohibits discrimination against consumers who don’t have credit cards.

Consumer advocates say cashless businesses effectively discriminate against poor customers who don’t have access to credit or bank accounts, and seniors who aren’t comfortable paying with plastic or digital devices. Nearly 6 percent of residents in the Philadelphia region were unbanked in 2017 and roughly 22 percent were considered “underbanked,” according to the Federal Deposit Insurance Corporation.

The legislation’s primary sponsor, Assemblyman Paul Moriarty (D., Gloucester), acknowledged that few businesses in the Garden State have gone cashless. But he described the law as a “solution to an imminent problem.”

“I’m pleased we are now the second state in the country that will now make it clear that the U.S. dollar is legal tender and that retail establishments should accept it or face the consequences,” Moriarty said, referring to a similar law adopted by Massachusetts in 1978.

There is no federal law mandating that a private business accept currency or coins as payment for goods or services, according to the Federal Reserve Board of Governors. Private businesses are free to develop their own policies on whether to take cash unless there is a state law that says otherwise.

The New Jersey law applies to brick-and-mortar retailers and excludes transactions made by phone, mail, or online. It also carves out retailers inside airports, car rental companies, and certain parking facilities. Specifically, the law exempts municipal-owned parking facilities, parking facilities that accept only mobile payments, car rental companies that accept cashier’s or certified checks, and airports as long as a terminal has at least two food retailers that take cash.

Moriarty said the law should prevent Amazon from opening one of its cashierless stores in New Jersey. Amazon sought a carve out from the Philadelphia law and also spoke with New Jersey lawmakers about their legislation.

Amazon has one cashless bookstore inside the Garden State Plaza mall in Paramus, Bergen County. The online retail giant plans to open up to 3,000 Amazon Go cashierless stores across the country over the next few years. The convenience stores allow consumers with a mobile app to grab items they need and leave, eliminating the need for a traditional checkout process. After the customer leaves, Amazon charges the user’s online account.

Amazon did not immediately return a request for comment.

The New Jersey Business & Industry Association said the new law “removes a business owners’ right to freely determine how they would like to receive payment."

“The preference for retailers to run a cashless business is often based on efficiencies and, in some cases, as a safety measure,” Michael Wallace, NJBIA vice president of government affairs said in a statement. “Consumers of all income levels are able to access pre-paid cards for purchasing. As such, this law will ultimately stifle innovation and act as a further deterrent to doing business in New Jersey.”

Not all businesses opposed the law. Cardtronics, the world’s largest ATM operator, supported the New Jersey legislation and the Philadelphia measure.

“Cash remains the top payment choice among consumers in the U.S. because it is inclusive,” Cardtronics spokesperson Crystal Wright said. “Cash is freedom and freedom is the ability to choose how you pay.”

Americans are less reliant on paper bills and coins, according to a Pew Research Center survey released in December. The survey of 10,683 U.S. adults found that 29 percent said they made no purchases using cash during a typical week, up from 24 percent in 2015. Likewise, those who made all or almost all of their weekly purchases with cash dropped from 24 percent in 2015 to 18 percent today, according to the survey.

Kenneth Rogoff, a Harvard economics professor, said the government should play a role in regulating the transition to a more cashless economy, but said mandating that a store must take cash is “a very heavy-handed intervention.”

“There’s a reason stores do this, and many of the stores that only take cash are engaged in tax evasion,” said Rogoff, author of The Curse of Cash.

Legislation banning cashless stores has been introduced in Chicago, New York City, San Francisco, and Washington, D.C.