There is no federal law requiring businesses to accept cash as payment for goods or services, but some cities (such as Philadelphia, New York City and San Francisco) and a few states (New Jersey, Massachusetts, Rhode Island) have laws in place banning businesses from refusing to accept cash, except under particular circumstances.  For most businesses in the U.S., they are to free to set their own policies in regard to accepting cash but banning it may not be in their best interests.

Although there are benefits to going cashless; contactless transactions, reduction in theft, decrease in time to check-out, increased efficiency in bookkeeping; there are also multiple drawbacks. Going 100% cashless will increase credit card fees paid since will be paying fees on all transactions, and there is the possibility that the credit card system will go down completely stopping all commerce. Also, some individuals will choose to not frequent a business that does not accept cash, and others do not have another form of payment, therefore unable to make purchases. In addition, an indirect consequence of a business going cashless is the possibility of a claim of a civil rights violation being made. Depending on the circumstances, cashless businesses may be viewed as discriminatory, designed to keep away lower-income individuals who do not have credit cards. Before a business goes cashless, it should consider all direct and indirect consequences of such a policy.

https://www.federalreserve.gov/faqs/currency_12772.htm