All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger.
We think that you have mingled two Ahaadeeth reported by Muslim . The first Hadeeth is narrated by Anas that the Prophet distributed the war booty of Hunayn among the people of Quraysh and the Ansaar were unhappy at his division and said: ''May Allaah forgive the Messenger of Allaah as he gives the people of Quraysh, and leaves us although our swords are still dribbling with their blood. Upon this, the Messenger of Allaah () said: I give to these men who are still close to their Pre-Islamic period of ignorance to attract their hearts (to Islam). Won't you be pleased that the people take the worldly things and you take Allaah's Messanger with you to your homes? By Allaah, that with which you will return is better than that with which they will return. They (the Ansaar) said: O Messenger of Allaah, we are pleased. The Prophet said: ''You will find others favoured over you greatly, so be patient until you meet Allaah and His Messenger and I will be at the Basin. Then they said: “We will be patient....”
Hence, the money that is distributed in this Hadeeth is not Zakah money; rather, it is war booty. The Ansaar wanted to have a share in this wealth as they were among the fighters and the fighters have a share in the booty of war but the Prophet clarified to them that he gave the booty to others in order to win them to Islam and he did not give the Ansaar due to their strong faith and because they would go back to Madeenah with the Prophet and this is better for them than the enjoyment of this worldly life.
Moreover, in Musnad Ahmad it was reported that the Prophet said to them: ''Are you angry, O group of Ansaar, because I have given away some material goods to those whom I sought to win to Islam, whereas I deemed your faith to be based on solid conviction? Would you not, O group of Ansaar, be pleased that people go away with sheep and camels while you go with the Prophet ? ……..So they cried until their beard became wet with tears, and then they said: “We are pleased with the Prophet as our share and as our lot.''
The second Hadeeth was also reported by Muslim in the Book of Zakah in a chapter entitled "Khawaarij and their characteristics": Abu Sa’eed Al-Khudri said: “While Ali was in Yemen, he sent some gold in its ore to the Messenger of Allaah (), and the Messenger of Allaah distributed it among four men: Al-Aqra’ Ibn Haabis Al-Hanthali, 'Uyaynah Ibn Badr Al-Fazaari, 'Alqamah Ibn 'Ulaathah Al-'Aamiri who belonged to the tribe of Kilaab and to Zayd Al-Khayr At-Taa’i who belonged to the tribe of Bani Nabhaan. Upon this, the people of Quraysh felt angry and said: Do you give the chiefs of Najd and ignore us? Thereupon, the Prophet said: ''I have done this in order to attract their hearts (make them firm in Islam)….”
However, it is not mentioned in this Hadeeth that he sent it to the people of Najd.
It is most likely that this golden piece that 'Ali sent was not from the Zakah; rather it was from the Rikaaz (i.e. a treasure buried in the earth at the time of pre-Islamic period) or it was from the booty of war. Indeed, Badr Ad-Deen Al-‘Ayni said in his book ‘Umdatul Qaari’: “There is a difference of opinion about this golden piece, it is said that it was one fifth of the one fifth (i.e. the share of the Prophet from the booty of war), and it is also said that it was a portion from the one fifth (the war booty), and it was the Prophet's exclusive right to give it to any category of recipients according to the benefit of Muslims.”
According to the terminology of the jurists one-fifth is a name for what is taken from the war booty, and also for the Rikaaz and the similar matters from which one fifth is taken, but it is not from the Zakah. Besides, according to the majority of the scholars the recipients of the one-fifth taken form the Rikaaz are different from the recipients of Zakah.
The Fiqh Encyclopedia reads: “The majority of the scholars (from the Hanafi, Maaliki Schools of jurisprudence and the chosen opinion of the Hanbali School and it is also the view of Al-Muzani from the Shaafi’i School) are of the view that one-fifth of the Rikaaz should be spent the same manner the war booty is spent and it is not a Zakah. Therefore, it could be given to the rich and it is not exclusively spent on the poor. Rather, it is dedicated for the benefits of the Muslims and it is not spent on the eight categories of the recepients of Zakah…”
Based on that, if the piece of gold that ‘Ali had sent was not from Zakah, then there was no problem in sending it (to the Prophet ) and not distributing it in Yemen. Also, mentioning this Hadeeth in the Chapter of Zakah does not necessarily mean that this piece of gold is from the Zakah. Indeed, the scholars mention the Rikaaz in the Chapter of Zakah, and they mention the voluntary charity in the Chapter of Zakah as well. Besides, Imaam Muslim stated in the Chapter of Zakah many Ahaadeeth about the excellence of spending on one's family and children, and those who are possessed by one’s right hand (the slaves), and the sin of the one who spoils them or does not spend on them. Also, Al-Bukhari entitled a Chapter in the Book of Zakah: "One fifth of Rikaaz is due".
Allaah Knows best.