Capital Gains Tax following a Peso Devaluation

Interestingly, and logically, all property transactions in Mexico are registered in Pesos at the Public Registry. That means that if you have made an agreement to purchase in Dollars, and the Peso devalues drastically before you have closed and registered the sale, you may have an angry seller who realizes he is now subject to higher capital gains tax.
What? What happened?
Let's say that the Seller bought his house for $150,000 US (worth of Pesos) in 1999. Now in 2004 he decides to sell. He sells it for $150,000 US which now buys like 40% more Pesos. He may be experiencing a taxable capital gain even though he bought and sold for the same amount of Dollars!
The reverse side of the coin is that if you purchase while the Peso is devalued, say at 15P/USD and then sell at say 12P/USD, you get a registered base value that is high and when you sell you may actually have a net tax loss, even though you got the amount of Dollars you really wanted!