The building (the bricks and mortar) can be owned by a non-Thai national outright in their name in what is called the house registry, which secures ownership indefinitely of the structure.
In Thailand, non-Thai nationals cannot own land outright in their name. Land can be controlled through either a Thai Company or a long-term registered lease. The longest registered lease term by Thai law is 30 years, and most developers will offer 3 terms for a total of 90 years.
Read more here