The Prophet ﷺ used to sell the date palms of Banu Nadir and set aside for his family their provision for a year.
أن النبي ﷺ كان يبيع نخل بني النضير ويحبس لأهله قوت سنتهم.
Bukhari related it in the Book of Expenditures (5357) and Muslim in the Book of Jihad (1757), both from the hadith of Ibn Uyayna, who said, Maamar said to me, Thawri said to me, "Have you heard anything about a man who gathers for his family provisions for a year or part of a year?" Maamar said, "It did not come to mind at first, then I recalled a hadith that Ibn Shihab Zuhri narrated to us, from Malik bin Aws, from Umar," and he related it. The wording given here is Bukhari's, and Muslim's wording is similar. Storing food for one's family is not called hoarding.As for what is reported from Umar bin Khattab as a raised hadith, "Whoever hoards food against the Muslims, Allah will strike him with leprosy and bankruptcy," this is daif. It was related by Ibn Majah (2155), Ahmad (135), and Abd bin Humayd (17), all from the hadith of Haytham bin Rafi Tatari Basri, who said, Abu Yahya, a man from the people of Makkah, narrated to me, from Faruq the freedman of Uthman, that Umar, who was at that time the commander of the believers, went out to the masjid and saw food scattered about. He said, "What is this food?" They said, "Food that has been brought to us." He said, "May Allah bless it, and bless whoever brought it." It was said, "O commander of the believers, he has hoarded it." He said, "Who has hoarded it?" They said, "Faruq the freedman of Uthman, and so-and-so the freedman of Umar." He sent for them and summoned them, and said, "What led the two of you to hoard the food of the Muslims?" They said, "O commander of the believers, we buy with our own money, and we sell." Umar said, "I heard the Messenger of Allah ﷺ," and he related it. Its chain is daif because of Abu Yahya Makki, for he is unknown.Dhahabi said in al-Mizan (4/587), "He is not known, and the report is munkar. Ahmad related it in the Musnad of Umar." And he said in the biography of Haytham bin Rafi, "His hadith on hoarding has been deemed munkar." And he said, "As for Abu Yahya, it is not known who he is."On this topic there is also what is reported, again from Umar, as a raised hadith, "The one who brings goods to market is provided for, and the hoarder is cursed." It was related by Ibn Majah (2153), Abd bin Humayd (33), Darimi (2582), and Hakim (2/11). In all of their chains is Ali bin Zayd bin Jadan, who is daif, declared daif by Ibn Madini and others.On this topic there is also what is reported from Ibn Umar as a raised hadith, "Whoever hoards food for forty nights has freed himself from Allah Almighty, and Allah Almighty has freed Himself from him, and whatever people of a settlement wake to find a hungry person among them, the protection of Allah Almighty has been withdrawn from them." Ahmad related it (4880) from Yazid, who said, Asbagh bin Zayd informed us, Abu Bishr narrated to us, from Abu Zahiriya, from Kathir bin Mura Hadrami, from Ibn Umar, and he related it. Abu Bishr is unknown, and Yahya bin Main declared him daif. Abu Hatim said, "This is a munkar hadith, and I do not know Abu Bishr" (al-Ilal 1/392).Hakim related it (2/11-12) via Amr bin Husayn Aqeeli, who said, Asbagh bin Zayd Juhani narrated to us, from Abu Zahiriya with his chain, but he dropped "Abu Bishr" from between Asbagh bin Zayd and Abu Zahiriya. Dhahabi said, "They abandoned Amr, and Asbagh has some weakness in him." Hakim noted, at the end of the six hadiths he had presented, that they were not upon the standard of his book.On this topic there is also what is reported from Abu Hurairah, who said, the Messenger of Allah ﷺ said, "Whoever practices hoarding, seeking to raise prices against the Muslims by it, is a sinner." Ahmad related it (8617) from Siraj, who said, Abu Mashar narrated to us, from Muhammad bin Amr bin Alqama, from Abu Salama, from Abu Hurairah, and he related it. Abu Mashar's name is Najeeh bin Abdul-Rahman Sindi, who is daif according to the majority of scholars.However, Hakim related it (2/12), and from him Bayhaqi (6/30), by another route, from Ibrahim bin Ishaq Usayli, who said, Abdul-Ala bin Hammad narrated to us, Hammad bin Salama narrated to us, from Muhammad bin Amr with his chain, similarly. Hakim said, after mentioning six hadiths, of which this was one, "I sought out these six hadiths and included them in their place in this book, out of concern for the hardship people face with this issue, and Allah will remove it, even though they are not upon the standard of this book." Dhahabi said, "Usayli used to steal hadiths."On this topic there is also what is reported from Maqil bin Yasar, and Abu Umama Bahili, and others. What is correct is what I have mentioned.The meaning of the hadith and its jurisprudence. Abu Dawud said, "I asked Ahmad, what is hoarding? He said, whatever affects people's livelihood." Abu Dawud said, "Uzai said, the hoarder is one who intercepts the market." And he said, following the hadith of Maamar (3447), "Saeed bin Musayab used to store up date pits, chaff, and seeds."Tirmidhi said (1267), "The hadith of Maamar is a hasan sahih hadith. The practice among the people of knowledge is upon this, they disliked the hoarding of food, and some of them permitted hoarding in things other than food."Khattabi said, "The hadith came with a general wording, but a specific meaning is intended by it, and it is reported from Saeed bin Musayab that he used to hoard oil." And it is reported from Imam Ahmad that he said, "Hoarding applies only to food specifically, because it is the sustenance of the people." Hasan and Uzai said, "Whoever brings food from another town and holds it back, waiting for the price to rise, is not a hoarder, rather the hoarder is one who intercepts the market of the Muslims."For this reason it is permissible for the ruler to prevent merchants from hoarding food and the sustenance of the people, so that the general public is not harmed. As for storing provisions for oneself and one's family, this is permissible, for the Prophet ﷺ used to store provisions for a year for his wives after the conquest of Khaybar.