Umar acquired some land at Khaybar. He came to the Prophet ﷺ and said, "I have acquired land more precious to me than any wealth I have ever gained. What do you advise me to do with it?"The Prophet ﷺ replied, "If you wish, you may preserve the property itself and give its yield as charity."So Umar gave it as charity on the condition that the land itself would not be sold, gifted, or inherited. Its produce was to be spent on the poor, on relatives, on freeing slaves, in the cause of Allah, on the wayfarer, and on guests. There is no blame on whoever administers it if he eats from it in a reasonable manner or feeds a friend, without seeking to accumulate wealth from it.
أخبرنا حميد بن مسعدة قال حدثنا يزيد وهو ابن زريع قال حدثنا ابن عون عن نافع
أصاب عمر أرضا بخيبر فأتى النبي ﷺ فقال أصبت أرضا لم أصب مالا قط أنفس عندي فكيف تأمر به قال إن شئت حبست أصلها وتصدقت بها فتصدق بها على أن لا تباع ولا توهب ولا تورث في الفقراء والقربى والرقاب وفي سبيل الله والضيف وابن السبيل لا جناح على من وليها أن يأكل منها بالمعروف ويطعم صديقا غير متمول فيه
Bukhari narrated it in the Book of Wills, the Chapter on how a waqf should be written, hadith 2772, from the hadith of Yazid bin Zuray, and Muslim narrated it in the Book of Wills, the Chapter on waqf, hadith 1632, from the hadith of Abdullah bin Awn, with the same wording. It is also found in Sunan al-Kubra, hadith 6426.