Religious Act Vs. Charity(Masechet Berachot Daf לב: Perek 5 Siman 81)
(condensed from Ein Ayah, Berachot 5:81)
Gemara: A fast day is greater than charity, for the former involves the body and the latter involves money.
Ein Ayah: It is hard to overestimate the value of mitzvot between people, as one benefits from their “fruit” in this world and gets full payment in the world to come. Yet, mitzvot involving Hashem have certain advantages over mitzvot between people. The foundation of service of Hashem is to bring one closer to the Divine, reaching a climax with the idea of becoming attached to His ways, besides the good deeds that one performed to get there. A person’s nature can become straight, enabling him to do many good deeds, including acts of kindness to his fellow man.
When a person distances himself from service of Hashem, he will draw closer to materialism and animalistic behavior and eventually will curtail his acts of charity and kindness. Therefore, an act of charity, if not done for the right reasons, is just an individual good deed. If he does not act to separate himself from materialism, he is liable to end up doing many regrettable things, following bad characteristics without the knowledge of Hashem in his heart. Therefore, we prefer the act that increases fear of Hashem in his heart, which is the foundation of ethical behavior.
In this way, fasting, which helps remove a person’s animalistic tendencies and sanctify him from desires, can mold a personality more than an individual act of kindness. That is what the gemara means by the distinction between involving the body (i.e., personality), as opposed to one’s money (i.e., an external, individual act). Also, if in the course of doing an act of kindness one breaks dictates of the Torah or of modesty, his charity turns into a sin, as his infractions can bring on many bad results, including eventually, curtailing future acts of kindness. It is better to perform fewer acts but with fear of Hashem, which is pure and everlasting.