YES, the Political Constitution of Costa Rica does not differentiate between foreigners and locals; Regarding the purchase and sale of properties, both have the same rights. Although not all banks finance the purchase of a property from a foreign or non-resident person.
Some banking or financial institutions require some form of roots in Costa Rica, such as having a formal job in the country, being married to a national or having a Costa Rican child, already having property within the national territory, etc.
But in case of not having that roots, there are banks that can also finance the purchase of your property.
We can gladly advise you.