Arsenal, its all very simple really and I am surprised that a man of your age and experience has yet failed to work it out.
Prostitution (to prostitution oneself) is illegal in Thailand, as it is in many other countries. However the services offered by Mr Wal-Mart, Mr Spielberg and Mr Decorator are not illegal. They have set prices for their services, they raise invoices, they issue receipts including applicable service taxes, they pay their corporation and income taxes and they have their accounts audited. Their businesses are legit.
However sexual favors provide by Thai bar boys are not legitimate and they cannot perform any of the above business procedures so must provide their services free of charge. All they can hope for is a tip.... a LARGE tip. If punters give tips to the boys for the 'free' sexual favors, then no laws are broken, no taxes are payable and there are no accounts to be filed or audited. Everyone is happy. TIT.