Praise be to Allah.
The hadeeth referred to was narrated by Imam Ahmad (17990) and Ibn Maajah (2481) from Sa‘eed ibn Hurayth (may Allah be pleased with him) who said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “Whoever sells a house or piece of land then does not put its price into something similar deserves not to be blessed therein.”
Ibn Maajah (2482) narrated that Hudhayfah ibn al-Yamaan (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “Whoever sells a house and does not put its price into something similar will not be blessed therein.”
This hadeeth was classed as hasan by Shaykh al-Albaani (may Allah have mercy on him) in as-Silsilah as-Saheehah, 5/326, when all its isnaads and corroborating reports are taken together.
Al-Manaawi (may Allah have mercy on him) said concerning the meaning of the hadeeth, “Whoever sells a house…”: Because it is the price of blameworthy worldly adornment, and Allah created the earth and made it a dwelling place for His slaves, and He created the two races (of mankind and the jinn) to worship Him, and He made that which is on earth as an adornment for it, “in order that We may test them (mankind) as to which of them are best in deeds” [al-Kahf 18:7]. So it became a trial for them, “Except him on whom your Lord has bestowed His Mercy” [Hood 11:119] and protected him. And it became a means of disobedience, so the blessing was taken away from it. So if it is sold and the money is used to buy a store, he will not be blessed therein, because he has done something contrary to Allah’s plan to make the earth a resting place (cf. 78:6).
But if he puts its price into something similar, then he has kept things in accordance with Allah’s plan, so he will attain the blessing that Allah has put in it. The blessing is connected to Allah’s plan for His creation.
End quote from Fayd al-Qadeer, 6/119
Abu Ja‘far at-Tahhaawi (may Allah have mercy on him) said: It is as if Ibn ‘Uyaynah understood the words of Allah, may He be glorified and exalted, “and He blessed it, and measured therein its sustenance” [Fussilat 41:10] as referring to the earth, so whoever sells a house or piece of land has sold that which Allah blessed, so He punishes him by causing there to be no blessing in what he bought of other things such as properties and stores. And we ask Allah for guidance and help.
End quote from Bayaan Mushkil al-Athaar, 9/206
Mullah ‘Ali al-Qaari said: Selling land and houses and using the money to buy movable items is not mustahabb, because it has a lot of benefits and is not subject to developing problems; no one could steal it or raid it and take it away, unlike movable items. So it is better that it not be sold and it is better that it is price be put into (buying) another piece of land or a house.
End quote from Mirqaah al-Mafaateeh Sharh Mishkaat al-Masaabeeh, 5/1983
What is meant by “putting its price into” is using it to buy a house or piece of land, when buying houses and land leads revitalising dead land. There is no difference between buying a house that is already built or buying a piece of land then building on it to achieve the purpose, which is to revitalise and develop dead land.
Al-Manaawi (may Allah have mercy on him) said: Because man is required to leave a legacy on the land, so when his legacy is erased by selling (his property) because he wants the price, he will be punished by missing out on the blessing.
End quote from Fayd al-Qadeer Sharh al-Jaami‘ as-Sagheer, 6/121
This ruling applies when there is no real need to sell the piece of land or house. If there is a real need to sell it, such as if a person is in debt and payment is now due, and so on, and he has nothing except this house, then this is not included in the hadeeth; rather he has to sell it and pay off his debt.
And Allah knows best.