Visa and Mastercard do very explicitly allow cash discounts.
https://usa.visa.com/content/dam/VCOM/global/support-legal/d...
What they didn’t allow previously was adding a surcharge to credit transactions. But regulation forced them to allow that as well. So not the best example overall.