The first thing about Thailand and buying property is that there are restrictions, and yet there are restrictions on many types of property buying worldwide so this is not a unique situation to Thai law,
Foreigners cannot buy or own land but they are able to buy the property that sits on the land. This is in a way a leasehold situation yet with differences.
Foreigners may buy the following properties:
A unit in a registered Condominium.
A registered leasehold of up to 30 years for all types of titled land or buildings.
A building distinct from its land.
Foreign nationals may not own:
More than 49% of the shares in a Thai company that owns freehold land.
Before buying any property of any type in Thailand contact a lawyer who know Thai law inside out and to be educated on Foreign Exchange Transaction Form (FETF) which is a key element of the buying process in Thailand.
If you marry a Thai person the situation changes completely, as it does in many other parts of the world in regards to ownership and buying assets. Get a lawyer to explain the legal ways that a foreigner buys property in Thailand before you fall foul of Thai law.