The Messenger of Allah ﷺ said, "Whenever a Muslim plants a crop or sows a tree, and a bird, a person, or an animal eats from it, it is counted for him as charity."
حدثنا يونس حدثنا أبو عوانة عن قتادة
قال رسول الله ﷺ ما من مسلم يزرع زرعا أو يغرس غرسا فيأكل منه طير أو إنسان أو بهيمة إلا كان له به صدقة
Its chain of transmission is sahih. It is found in Bukhari 5/3, no. 2320, Fath al-Bari, in the book of farming and sharecropping, chapter on the merit of planting, and in Muslim's chapter on sharecropping, similarly, 3/1189, no. 1553, with its chain and wording, as well as many others besides them.