Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
bayhaqi:12096Abū ʿAbdullāh al-Ḥāfiẓ > Abū ʿAlī al-Ḥusayn b. ʿAlī al-Ḥāfiẓ Imlāʾ > Aḥmad b. al-Ḥusayn al-ʿIjlī Bi-al-Kūfah > Abū Kurayb > Abū Usāmah > Zāʾidah > Manṣūr > Ṭalḥah b. Muṣarrif > Anas b. Mālik

[Machine] That the Messenger of Allah, ﷺ , passed by a date palm on the road and said, "If it were not for it being a form of charity, I would have eaten it."  

البيهقي:١٢٠٩٦أَخْبَرَنَا أَبُو عَبْدِ اللهِ الْحَافِظُ ثنا أَبُو عَلِيٍّ الْحُسَيْنُ بْنُ عَلِيٍّ الْحَافِظُ إِمْلَاءً ثنا أَحْمَدُ بْنُ الْحُسَيْنِ الْعِجْلِيُّ بِالْكُوفَةِ ثنا أَبُو كُرَيْبٍ ثنا أَبُو أُسَامَةَ عَنْ زَائِدَةَ عَنْ مَنْصُورٍ عَنْ طَلْحَةَ بْنِ مُصَرِّفٍ عَنْ أَنَسِ بْنِ مَالِكٍ

أَنَّ رَسُولَ اللهِ ﷺ مَرَّ بِتَمْرَةٍ بِالطَّرِيقِ فَقَالَ لَوْلَا أَنْ تَكُونَ مِنَ الصَّدَقَةِ لَأَكَلْتُهَا  

رَوَاهُ مُسْلِمٌ فِي الصَّحِيحِ عَنْ أَبِي كُرَيْبٍ وَقَالَ الْبُخَارِيُّ وَقَالَ زَائِدَةُ عَنْ مَنْصُورٍ فَذَكَرَهُ

See similar narrations below:

Collected by Bukhārī, Muslim
bukhari:2431Muḥammad b. Yūsuf > Sufyān > Manṣūr > Ṭalḥah > Anas

The Prophet ﷺ passed a date fallen on the way and said, "Were I not afraid that it may be from a Sadaqa (charitable gifts), I would have eaten it."  

البخاري:٢٤٣١حَدَّثَنَا مُحَمَّدُ بْنُ يُوسُفَ حَدَّثَنَا سُفْيَانُ عَنْ مَنْصُورٍ عَنْ طَلْحَةَ عَنْ أَنَسٍ ؓ قَالَ

مَرَّ النَّبِيُّ ﷺ بِتَمْرَةٍ فِي الطَّرِيقِ قَالَ لَوْلاَ أَنِّي أَخَافُ أَنْ تَكُونَ مِنَ الصَّدَقَةِ لأَكَلْتُهَا وَقَالَ يَحْيَى حَدَّثَنَا سُفْيَانُ حَدَّثَنِي مَنْصُورٌ وَقَالَ زَائِدَةُ عَنْ مَنْصُورٍ عَنْ طَلْحَةَ حَدَّثَنَا أَنَسٌ  

muslim:1071bAbū Kurayb > Abū Usāmah > Zāʾidah > Manṣūr > Ṭalḥah b. Muṣarrif > Anas b. Mālik

If it were not out of Sadaqa, I would have eaten it.  

مسلم:١٠٧١bوَحَدَّثَنَا أَبُو كُرَيْبٍ حَدَّثَنَا أَبُو أُسَامَةَ عَنْ زَائِدَةَ عَنْ مَنْصُورٍ عَنْ طَلْحَةَ بْنِ مُصَرِّفٍ حَدَّثَنَا أَنَسُ بْنُ مَالِكٍ

أَنَّ رَسُولَ اللَّهِ ﷺ مَرَّ بِتَمْرَةٍ بِالطَّرِيقِ فَقَالَ لَوْلاَ أَنْ تَكُونَ مِنَ الصَّدَقَةِ لأَكَلْتُهَا