In Japan, it isn’t cheating as long as you pay for it.

A judge in Tokyo ruled Monday that having an affair with someone who’s married cannot be considered adultery if it involves the exchange of money.

“Even if the wife is disgusted by the act, it does not constitute a legal offense,” Judge Masamitsu Shiseki said after ruling that a bar hostess who had a seven-year affair with a rich businessman could not be blamed for breaking up his marriage.

“The defendant had sexual relations with her patron only for business . . . and such conduct does not damage peaceful marital life,” Shiseki wrote in his ruling.

“Many club hostesses, as is well known, engage in ‘pillow business,’ and these ‘pillow business’ sales, which are similar to prostitution, involve no more than engaging in sex for the purpose of satisfying their customers’ sexual urges.”

The issue was initially sparked due to another bizarre Japanese law, which gives a spouse the right to claim financial compensation for adultery from the person their husband or wife has been cheating with. Officials claim the measure is supposed to protect the institution of marriage.