No. The grounds for obtaining a residence permit in Switzerland include:
payment of lump-sum tax;
work in the country;
opening a business;
study at school or university;
family reunification.
You can buy residential real estate for yourself by obtaining a residence permit in the country on other grounds. The purchase of housing by non-residents is limited by the Lex Koller law: they can only purchase holiday properties subject to availability of quota places in the canton.