Permission from the Ministry of Justice (foreigners)
As a foreigner, you do not need a Swedish citizenship or a Swedish social security number in order to buy an apartment or house in Sweden. However, you are required to show that you are 18 years old or older. This can be done through e.g. a copy of your passport.
If you are a EU-citizen and plan on moving to Sweden and maintain in the country, you must register at Skatteverket. This enables you a Swedish social security number.
If you are not a EU- or EES-citizen and want to move to Sweden, you must apply for a residence permit. You can do this at either the Swedish embassy or consulate in the country you are moving from, or at Migrationsverket after your arrival to Sweden.