Fiqh-us-Sunnah Volume 4, Funerals and Dhikr, Fiqh 4.075B.
Ibn Qudamah said: “A burial in a cemetery is better for a servant of Allah than being buried in home, for this is less harmful to survivors in his family, is more like the dwellings of the hereafter, and is more suitable a place for making supplications for forgiveness and mercy for the dead. The Companions, their Successors, and those after them buried their dead in the deserts in cemeteries.
Some people may ask: “Why then were the Prophet, peace be upon him, and his two Companions buried in his home?” In answer to this we would refer to the statement of ‘Aishah in which she said: “This was done lest the grave of the Prophet be turned into a mosque.” (Bukhari) The Prophet, peace be upon him, buried his Companions in the cemetery of “al-Baqi’ in Madinah and surely his action is more preferable than someone else’s action. The Companions of the Prophet regarded his burial arrangements as a special case for him because, as reported in a tradition “the Prophets are buried at the place they die,” and because burying him at his home distinguished his grave from those of others, and protected it from being exposed to great numbers of people, he was buried at home.
When asked about a man who had instructed in his will that he be buried in his house, Ahmad said: “He should be buried with Muslims in their cemetery.”