Foreign nationals must have a Swiss residence permit in order to legally buy property in Switzerland. The exception is for buying property in tourist areas, which is open to any foreigner.