Question: I heard that if I give Tzedakah but also intend to earn myself a good name, this is forbidden. Is this correct?
Answer: The Gemara (Ketubot 66b) recounts that one of the wealthiest individuals in Jerusalem who passed away during the era of the second Bet Hamikdash was named Nakdimon ben Gurion. Needless to say, his daughter was also a very affluent woman as a result of the great wealth she received from her father.
Once, Rabban Yochanan ben Zakkai was riding on a donkey on his way out of Jerusalem accompanied by his students. Suddenly, Rabbi Yochanan noticed a woman gathering barley kernels from the dung of animals belonging to Arabs (the Gemara there also records that she would gather barley kernels from the hooves of horses in Acco) because she was so poor that she had nothing to eat and she had no choice but to do this. When she saw Rabbi Yochanan, she approached him and said, “Rabbi, provide me with sustenance!” Rabbi Yochanan sked, “My daughter, whose daughter are you?” She replied, “I am the daughter of Nakdimon ben Gurion.” Rabbi Yochanan asked, “My daughter, where is all the wealth you received from your father?” She replied, “Do they not say in Jerusalem, ‘The salting of money is kindness?’” This means that if one wishes to preserve his wealth (like salted fish and vegetables), one must perform acts of charity and kindness with one’s money. On in this way will one’s money remain.
The Gemara asks: “Did Nakdimon ben Gurion not perform Tzedakah? Our Sages taught that when he would leave his house on his way to the Bet Midrash, his servants would place expensive fabrics under his feet (similar to a “red carpet” today) and the poor would then come and fold them up for themselves!” Meaning, Nakdimon was a tremendous philanthropist and if so, why did he lose all of his money? One opinion in the Gemara answers that he did so for his own honor and thus, this was not considered Tzedakah.
We see from here that if one performs a Mitzvah with the intention receiving honor for it, one loses the merit of the Mitzvah (see Meharsha ibid.). Similarly, the Gemara (Berachot 17a) states that anyone who is involved with a Mitzvah not for the sake of Heaven, it would have been better for him not to have been created.
Nevertheless, another Gemara (Nazir 23b) stands in contrast to the above: “Rav Yehuda said in the name of Rav: One should always be involved in Torah and Mitzvot even when this is not being done for the sake of Heaven, for eventually, this will cause one to do so for the sake of Heaven.” It seems from this Gemara that there is a benefit in performing Mitzvot even not for the sake of Heaven. This seems to contradict what the Gemara has taught us regarding Nakdimon ben Gurion and the Gemara in Masechet Berachot.
Indeed, the Tosafot (in their commentary on Pesachim 50b and Nazir 23b) pose the above seeming contradiction. The Tosafot answer that when one studies Torah without any intention of fulfilling the Mitzvot of the Torah and merely to seem great and knowledgeable in Torah, it is indeed better for such a person not to have been created. Similarly, if one is only studying Torah in order to hurt or bother others, it is better that he not learn in the first place, for Hashem has no interest in such Torah or Mitzvot. However, if one learns both in order to fulfill what one learns (for the sake of Heaven) and in order to acquire a good name for himself, then it is better that he study Torah in this manner and then, slowly but surely, he will grow and eventually learn Torah and perform Mitzvot in the proper manner. Maran Rabbeinu Ovadia Yosef zt”l rules likewise in his Responsa Yabia Omer, Volume 6, Even Ha’Ezer, Chapter 14. There are many other details involved here but we cannot delve into all of them at this point.
Summary: If one delves in Torah and performs Mitzvot with the intention of doing the will of Hashem but also has in mind to become great and to be considered a good person and the like, one should continue pursuing these good deeds. Nevertheless, if one studies Torah with the intention of hurting others with one’s knowledge or if one has no intention of fulfilling what one has learned, it is better that such a person had not been created, for Hashem has no interest in such Torah study and Mitzvot.