New Zealand bans most foreigners from buying homes