كتاب الزكاة
12  
The Book of Zakat
(53)
Chapter: The prophet (saws) accepted gifts but refused Charity
(53)
باب قَبُولِ النَّبِيِّ الْهَدِيَّةَ وَرَدِّهِ الصَّدَقَةَ ‏‏
Sahih Muslim 1077

Abu Huraira reported:

Whenever the Messenger of Allah (ﷺ) was presented with food, he asked about it, If he was told that it was a gift, he ate out of that, and if he was told that it was a sadaqa he did not eat out of that.
حَدَّثَنَا عَبْدُ الرَّحْمَنِ بْنُ سَلاَّمٍ الْجُمَحِيُّ، حَدَّثَنَا الرَّبِيعُ، - يَعْنِي ابْنَ مُسْلِمٍ - عَنْ مُحَمَّدٍ، - وَهُوَ ابْنُ زِيَادٍ - عَنْ أَبِي هُرَيْرَةَ، ‏.‏ أَنَّ النَّبِيَّ صلى الله عليه وسلم كَانَ إِذَا أُتِيَ بِطَعَامٍ سَأَلَ عَنْهُ فَإِنْ قِيلَ هَدِيَّةٌ أَكَلَ مِنْهَا وَإِنْ قِيلَ صَدَقَةٌ لَمْ يَأْكُلْ مِنْهَا ‏.‏
Reference : Sahih Muslim 1077
In-book reference : Book 12, Hadith 228
USC-MSA web (English) reference : Book 5, Hadith 2357
  (deprecated numbering scheme)