Indeed, although giving a discount for paying with cash is often allowed. (Customers generally hate hidden fees more than they hate missing out on a discount.)
It's not a way to cheat the system though, since you still have to advertise the higher price. Even if you also say "5% discount for cash transactions".