The networks allow cash discounts if it's posted clearly and the customer has an option to use a different payment method -- you see this on every gas station sign alongside every highway in America. (What's _not_ permitted is adding a secret surcharge or item mark-up for credit card payments)
The latter is allowed now - after the backs of the credit card processors were broken.
They fought tooth and nail against cash discounts OR credit surcharges and they finally lost. In some areas it's rampant that you get a pretty substantial discount - often 4 or 5%, better than cash-back - and many places post "cash prices".
You can get even more if you're willing to ride the hassle of the gift card train.
The credit card companies know people spend more if they use credit cards, and they turn around and sell that to the merchants.
Some European countries forbid a price difference but they also limit card fees very low, so the merchant doesn't lose money and you don't get cash back. Forbidding a price difference but allowing high fees is nothing but pure corruption.
This law overrides any prior contractual agreements with banks/processing companies that prohibit surcharges. This is previously how MasterCard and VISA coerced merchants into absorbing the processing fee, by contractually requiring credit same as cash pricing.