Being legal tender means that something must be accepted as payment for a debt; it does not mean that it must be accepted as payment when no debt exists. For example, if you go to a restaurant that serves you before giving you your check then they are required to accept cash. However, they are allowed (possibly depending on jurisdiction) to insist on being payed by card prior to serving you.
There's very little incentive to accept card only. Cash, unlike credit or debit cards, doesn't carry an interchange fee, which means the full amount is going to the business, instead of losing some money to interchange.