Originally, it is part of the Prophet’s Sunnah for neighbors to prepare food for the bereaved family, and not the other way round. This is based on a well-known Prophetic hadith in this regard in which the Prophet (peace and blessings be upon him) is reported to have urged Muslim neighbors of Ja`far’s family to prepare foods for them as the family of Ja`far was preoccupied by the sad incident of Ja`far’s death.
Dr. `Abdul-WahhabibnNasir Al-Tariri, the prominent Saudi scholar states the following: The act referred to in the question is opposite of Sunnah practice. In the Sunnah, neighbours of a bereaved family help them out by preparing food for them. This is a kindness so that the people who are bereaved and who are at the same time preoccupied with funeral preparations and other matters can be freed from the added burden of having to prepare their own food.
When Ja`faribnAbiTalib died, the Prophet (peace and blessings be upon him) said, “Prepare food for Ja`far’s family, they have something that is keeping them occupied” (At-Tirmidhi and Abu Dawud).
this means that preparing food for the family of the deceased should be done by their neighbors to help them out. The bereaved family may need such help. These days, with the proliferation of convenient and inexpensive restaurants, the need for the neighbors to prepare food for the bereaved family may not always exist. Still, preparing food for the deceased’s family should be done whenever the need for it arises.
It seems a bit cruel to insist that the bereaved family should be set to the totally unnecessary task of preparing food for the entire neighborhood!
If the family of the deceased prepares food for the neighbors in deference to local customs or under the pressure of social expectations, then they are doing nothing wrong, though we feel sorry for them for having to do so.
If the family of the deceased prepares food for their neighbors, believing that it is Sunnah to do so or that it is an act of religious devotion, then they are engaging in an unlawful innovation in their religion.
however, in either case, the food that they prepare will be lawful to eat. The food should not be wasted.