It's not directly a legal issue: Prior to Dodd-Frank, most/all merchant agreements only allowed for a "cash discount". That is, when agreeing to accept Visa or MasterCard, a merchant had to also agree to accept cards for all transactions and charge the same price no matter the payment type, excepting an option of a lower price for cash (but not for checks or debit cards).
Dodd-Frank made such agreements illegal: All merchant agreements must now include an option for the merchant to refuse credit (but not debit) cards for purchases under $10.
Convenience fees are apparently a rat's nest of state laws, litigation settlements and issuer policies:
http://www.cardfellow.com/blog/charging-customers-a-credit-c...