Vestal, NY -- Its easy to find a gas station sign offering a cash price cheaper than a credit price.

But did you know its illegal in New York to charge someone more for paying with a credit card?

Thats due to General Business Law 518, which prohibits surcharges on credit card purchases. A number of businesses, from a hair salon to a billiards saloon, lost a challenge to the law last week, the New York Law Journal reported.

On the other hand, its legal to charge less for cash than for credit. So, you can charge $12 for an item and offer a cash discount for $10. You cant sell an item for $10 and mark it up to $12 for credit cards.

That legal distinction was at the heart of a multi-year court battle that was decided Sept. 30 in the US Court of Appeals.

It stemmed from a Binghamton-area hair salon that sued the state, winning an injunction against the law in 2013. US District Judge Jed Rakoff called the law incomprehensible and noted wryly that Alice in Wonderland has nothing on section 518 of the New York General Business Law, referring to the nonsensical classic in ordering the law be unenforced.

But the three judge appeals court reversed Rakoffs decision last month, finding the law was constitutional.

Its rarely enforced, anyway: only one case had been prosecuted under the law, which calls for a $500 fine and up to a year in jail.

So businesses have to absorb those swipe fees from credit card companies without penalizing customers.