Hadithcore
Sahih Muslim, 1552 a
sahih

Jabir (Allah be pleased with him) reported Allah's Messenger (ﷺ) as saying:

Never does a Muslim plants a tree except that he has the reward of charity for him, for what is eaten out of that is charity; what is stolen out of that, what the beasts eat out of that, what the birds eat out of that is charity for him. (In short) none incurs a loss to him but it becomes a charity on his part.

حَدَّثَنَا ابْنُ نُمَيْرٍ، حَدَّثَنَا أَبِي، حَدَّثَنَا عَبْدُ الْمَلِكِ، عَنْ عَطَاءٍ، عَنْ جَابِرٍ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏

‏ مَا مِنْ مُسْلِمٍ يَغْرِسُ غَرْسًا إِلاَّ كَانَ مَا أُكِلَ مِنْهُ لَهُ صَدَقَةٌ وَمَا سُرِقَ مِنْهُ لَهُ صَدَقَةٌ وَمَا أَكَلَ السَّبُعُ مِنْهُ فَهُوَ لَهُ صَدَقَةٌ وَمَا أَكَلَتِ الطَّيْرُ فَهُوَ لَهُ صَدَقَةً وَلاَ يَرْزَؤُهُ أَحَدٌ إِلاَّ كَانَ لَهُ صَدَقَةٌ ‏

‏ ‏.‏

References2 variants
In-Book Reference
Book 22, Hadith 7
USC-MSA web (English) reference
Book 10, Hadith 3764 (deprecated numbering scheme)
Sharh · explanationclick to expand
Islam has encouraged all types of righteous and good acts and has made them worthy of reward and recompense. One of these righteous acts promoted by Islam is doing whatever entails goodness and benefit for human beings and animals. In this Hadīth, Jābir ibn ‘Abdullāh (may Allah be pleased with him and his father) narrates that the Prophet (may Allah's peace and blessings be upon him) entered "an orchard," i.e., a garden of palm trees, and ’Umm Ma‘bad was in that orchard. It is said: She is the wife of Zayd ibn Hārithah. The Prophet (may Allah's peace and blessings be upon him) asked her about the one who planted the palm trees in that orchard, whether he was a Muslim or a disbeliever. She informed him that the one who planted it was a Muslim. Thereupon, the Prophet (may Allah's peace and blessings be upon him) said: "No Muslim plants a plant," i.e., cultivates plants, "wherefrom a man, an animal, or a bird eats" he (may Allah's peace and blessings be upon him) mentioned them in general to include all living beings in the sea and on land, "except that it will be counted for him as a charity until the Day of Judgment" because of eating from what he has planted, as long as the benefit of such plants remains even if it remains until the Day of Judgment. The Muslim was mentioned in particular because he mostly plants with the intention that Muslims would gain strength from the fruits of such a plant to worship Allah Almighty and because the Muslim is the one who gets a reward. In contrast, the disbeliever does not get a reward for his good deeds, which might only alleviate his punishment, or he might be provided with food and thus be repaid in this world. The Hadīth indicates that rewards in the Hereafter for good deeds are exclusive to Muslims and not for the disbelievers. It also points out the merit of agriculture and cultivation given their effect in populating the earth and benefitting all creatures. It encourages the construction of earth so that man himself can live or those who come after him on account of whom he gets rewarded..