Of course, this is an example of price discrimination - where different consumers (or groups of consumers) are charged different prices for the same good or service, and where the difference in price does not arise because of a difference in cost. So, in this case there are two groups (foreigners and locals) paying different prices for the same thing (entry into Ayutthaya, or some other tourist attraction).
How can they get away with this? Well first, price discrimination is not illegal. If it were, then you couldn't haggle over any prices (and haggling is almost mandatory if you are shopping at the markets in Thailand and don't want to get ripped off!). Second, the seller needs some degree of market power - they need to be able to set the price. Since there are few substitutes for seeing Ayutthaya and there is only one supplier, that guarantees some market power here. Ok, so that's the basic market condition for price setting sorted.
For price discrimination to work though, you need to meet three conditions:
- Different groups of customers (a group could be made up of one individual) who have different price elasticities of demand (different sensitivity to price changes);
- You need to be able to deduce which customers belong to which groups (so that they get charged the correct price); and
- No transfers between the groups (since you don't want the low-price group re-selling to the high-price group).
On the other hand, locals have plenty of other activities they can do rather than visiting the tourist attraction (there are many substitutes), and the cost of entry is a large proportion of the total cost so is quite significant to them. So, locals tend to be more sensitive to price and raising the price of entry would deter them in greater numbers than foreign tourists.
Of course, it is relatively easy for the tourist operators to tell the foreigners from the locals (although I do wonder if Lao citizens, for instance, could sneak in by posing as locals). And from what I could tell, the tickets looked different for the locals from the foreigners and were checked on entry, so transfers between locals and foreign tourists didn't appear to be possible.
Now, having met those conditions and knowing that locals are more price sensitive than foreign tourists, it makes sense to charge the foreign tourists a higher price and locals a lower price. The foreigners won't be deterred by the high price, while the locals will come in greater numbers because of the low price for them. Voila! (I wonder what Thai for "voila" is?). Higher profits for the tourist operator, than if they set a single price for everyone.
Which brings me to my question. Why don't tourist operators in New Zealand make use of price discrimination? If I go to the Polynesian Spa in Rotorua for instance, there is one price that applies to everyone, not separate prices for locals and tourists. The conditions for these operators are the same for those in Thailand. Maybe they don't want to be seen to be price gouging tourists? Although that raises the question of why it is all right for the Thais to do it? Price discrimination could even be introduced by stealth  - instead of posting separate prices, you simply give a 10% (or whatever) discount to locals, while the 'regular' price (which turns out to only be paid by foreign tourists) is what is displayed. And being good to the locals makes for great press.
The only reason I can think of is a capacity issue. If your tourist attraction is capacity constrained, then lowering the price and attracting more locals might squeeze out some higher-paying foreign tourists. Having said that though, are there that many tourist attractions that are heavily capacity constrained?
Tourist operators in New Zealand may well be missing a trick. But at least they're not as bad as these failed attempts at price discrimination.
 Though this is not as stealthy as some places in Thailand, where the price for foreigners is written in Arabic numerals, while the price for Thais is written in Thai language.