Depends on the location. In the EU, it would be illegal to charge someone more for using a credit or debit card:
> You're not allowed to charge your customers extra for using a credit or debit card. This applies to all card purchases (in shops and online) made throughout the EU.
https://europa.eu/youreurope/business/finance-funding/making...
Guessing there are no such laws in the US? Or maybe nowhere else? Not sure.
Now the standard seems to be that a fee for credit is clearly posted and for gas stations, cash and credit prices are posted in equal prominance.
Debit cards are usually less expensive to accept, and I don't think I've seen a posted fee to use them since around the turn of the century (I seem to recall fee notices in the 90s, but I haven't seen one recently)
[1] https://www.mastercard.us/en-us/business/overview/support/me...