All perfect praise be to Allah, The Lord of The Worlds, and may His peace and blessings be upon our Prophet Mohammad and upon all his family and companions.
From the perspective of Sharia, selling spoiled or expired foods is prohibited because every Muslim is obliged to preserve the life of other Muslims and avoid every matter that could inflict harm on them or on their health; therefore, Sharia forbids selling harmful products to people as well as deceiving them. Prophet Mohammad (PBUH) said: " He who deceives is not of me (is not my follower)." {Muslim}.
Moreover, if the trader knows that the food has expired, then it is forbidden for him to sell it because it is ,mostly, harmful. Prophet Mohammad (PBUH) said: "There is no injury nor return of injury." {Ibn Majah}.
In addition, the trader is sinful because he has deceived others, and this is forbidden in Islam. Accordingly, if the expired food led to the death of a certain individual and the trader knew that it had expired while that individual didn`t, then the trader must pay the Diya (blood money) and the expiation because he is the cause of that person`s death. The same judgment applies in case the trader wasn`t aware that the food item that he had sold was expired because date of expiry is clearly indicated on the sold item. Moreover, the judge enjoys the authority to enforce discretionary punishments on such traders. And Allah knows best.