Mishkat al-Masabih 1833
وَعَنْ عَطَاءِ بْنِ يَسَارٍ مُرْسَلًا قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسلم: لَا تَحِلُّ الصَّدَقَةُ لِغَنِيٍّ إِلَّا لِخَمْسَةٍ: لِغَازٍ فِي سَبِيلِ اللَّهِ أَوْ لِعَامِلٍ عَلَيْهَا أَوْ لِغَارِمٍ أَوْ لِرَجُلٍ اشْتَرَاهَا بِمَالِهِ أَوْ لِرَجُلٍ كَانَ لَهُ جَارٌ مِسْكِينٌ فَتَصَدَّقَ عَلَى الْمِسْكِينِ فَأَهْدَى الْمِسْكِين للغني . رَوَاهُ مَالك وَأَبُو دَاوُد
From ʿAtaʾ ibn Yasar, in mursal form, who said: The Messenger of Allah ﷺ said: "Charity is not lawful for a rich person except for five: one fighting in the path of Allah, one who works in [collecting] it, one in debt, a man who buys it with his own money, or a man who has a poor neighbour, and charity is given to the poor man, and the poor man gives it as a gift to the rich man." Reported by Malik and Abu Dawud.