Muhammed bin Abi Haatim (rahimahullah) reports that when Imaam Bukhaari’s (rahimahullah) father passed away, Imaam Bukhaari (rahimahullah) inherited a large amount of wealth from him. Imaam Bukhaari (rahimahullah) would invest this wealth in mudhaarabah partnerships (a partnership where one partner puts up the capital and the other does the work of engaging in trade), and it was through this that he would earn an income. (Hadyus Saari pg. 479)
Imaam Bukhaari (rahimahullah) would spend the money that he earned upon himself and use the money in the pursuit of acquiring the knowledge of Hadith. He would also spend generously on the students of deen and would give abundantly in charity.
Imaam Bukhaari (rahimahullah) once mentioned the following to Ibnu Abi Haatim (rahimahullah), “My monthly income was five hundred dirhams. I would spend this entire amount in acquiring the knowledge of deen.”
Hearing this, Ibnu Abi Haatim (rahimahullah) remarked, “What a great difference there is between the one who acquires wealth to spend it in the path of deen, and the one who uses the knowledge of deen to acquire the wealth of the world!”
Imaam Bukhaari (rahimahullah) responded by reciting the following verse of the Qur’aan Majeed:
وَ مَا عِنۡدَ اللّٰهِ خَیۡرٌ وَّ اَبۡقٰی
The reward which is by Allah Ta‘ala is better and more-lasting (than the wealth of this world).
(Siyar A’laamin Nubalaa 12/449)
Regarding the manner in which Imaam Bukhaari (rahimahullah) would spend his wealth upon the students of Hadith, Muhammed bin Abi Haatim (rahimahullah) reports:
Imaam Bukhaari (rahimahullah) would spend abundant wealth in charity. When any student of Hadith was in need, he would hold his hand and give him approximately twenty to thirty dirhams, without anyone noticing that he had assisted this person or given him anything. Imaam Bukhaari (rahimahullah) would keep his purse with him at all times (to spend on the needy).
I saw Imaam Bukhaari (rahimahullah), on multiple occasions, giving the same student a bag containing three hundred dirhams. The only reason that I knew of the amount in the bag is that the person himself informed me of it later on.
The student mentioned to me that on one such occasion, Imaam Bukhaari (rahimahullah) gave him a lot of wealth in secret. Thereafter, during the dars of Hadith, the student wished to express his gratitude and make du‘aa for Imaam Bukhaari (rahimahullah) before the other students. However, Imaam Bukhaari (rahimahullah) did not want anyone to come to know of the financial assistance he had given to the student. Therefore, he immediately commanded the student to continue the dars and read the next Hadith which Imaam Bukhaari (rahimahullah) was to teach.”
(Siyar A’laamin Nubalaa 12/450)