As of January 27, 2013, Visa and Mastercard allow credit card surcharges. Prior to this I believe merchant agreements did allow for cash payment discounts, just not "surcharges", even though they are practically the same thing.
It was a long time ago that I worked a register, but at one point merchant agreements definitely disallowed cash discounts. I knew because on a slow day I actually read the fine print. The boss, correctly, didn't care that their discount for cash was forbidden, but I was young enough to be a little scandalized.
http://www.mastercard.us/merchants/support/surcharge-rules.h... http://usa.visa.com/personal/get-help/checkout-fees.jsp