We just bought a house primarily for the location location location, very close to the lake in Kanton Luzern with panoramic views

.
My husband and I both have B visas. I'm Canadian, he is German.
We were going to buy it in my name but when the Notary learned of my citizenship and visa status he added the Lex Koller to the contract. This would have restricted my rights on how to use the property. I would have had to have moved in within 6 months, use it only as my primary residence with family only and could not rent it out even though it has a granny flat/holiday apartment on the basement level.
We decided to change the contract to my husbands name since he is an EU national. We will have no restrictions on how we can use the property. This was very important to us because we plan to rebuild and this could take us up to 2 years before we could actually begin, we may even decide to rent it while we are in the planning phase, obviously for a reasonable rent due to the nature of a shorter term lease. Since he is an EU national he has the same full rights as a Swiss person regarding the acquisition of real estate. If I was on title as a joint owner then Lex Koller would have still applied and we would be stuck.
So ultimately if you are non EU you can buy property here but as others have said you would be restricted on how you use the property until you obtain the C permit which then gives you the right to settle. Our real estate agent with one of the largest more prominent agencies here in Switzerland was clearly not fully educated on this and it was all discovered rather late making for very stressful closing as all banking financing docs needed to be changed with just 2 days notice. Thankfully the contract was notarized today and we have the keys to our new holiday home:-)