Or until they cancel the transaction.
If you order the coffee, they say “okay that’ll be $2.87”, and you try to pay with cash, they can cancel the order. Poof, no debt.
Now if they drop the check at your table after you’ve enjoyed the cup of coffee, it’s different IMO.
They'd temporarily moved their debt onto you and now had to accept it back again. But it hasn't gone away.
For instance, someone should probably be barred from paying a personal debt of 1000 dollars in 1 cent coins. I couldn't google my way through the US code, for illustration this is the Singapore limits:
https://www.mas.gov.sg/currency/circulation-currency/accepti...
Unsurprisingly France also has rules on what limits can be set on accepting cash:
https://www.service-public.fr/particuliers/vosdroits/F10999#...).