Taking cash costs money as well: more security, more auditing, more cash transport, higher insurance costs, etc
Even better, because of forced cash now every business incurs those costs even if the overwhelming majority of their transactions aren’t in cash.
The solution to “discrimination against homeless” is not forcing people to take cash, it’s forcing banks to allow homeless people to open bank accounts.