“If there is a needy person among you, one of your kinsmen in any of your settlements in the land that the Lord your God is giving you, do not harden your heart and shut your hand against your needy kinsman. Rather, you must surely open your hand and lend him sufficient for their needs, whatever they are lacking.”
The Ohr Hachaim (17C), asks how the command to open your hand addresses the person in the previous verse who has a hard heart? He answers that the key is in the double language used in the second verse, “patoach tiftach” which literally means, not, “you shall surely open” but “open and it will open”. Moshe is telling the people that when they give charity to the needy, God will reward them by opening up the conduits of blessing for the giver also. The Ohr Hachaim is referring here to the Talmud’s idea that it is ok to test God with tzedakah, by giving charity. That one may give tzedaka with the hope, and perhaps the expectation, that their own monetary blessing will benefit from this act (Taanit 9a).
In contrast we see in Maimonides’ Mishnah Torah his opposition to seeing the mitzvot as anything utilitarian. As the Rambam says in the laws of Mezuzah, “It is a common custom to write [God’s name,] Shaddai, on the outside of a mezuzah opposite the empty space left between the two passages. There is no difficulty in this, since [the addition is made] outside. Those, however, who write the names of angels, other sacred names, verses, or forms, on the inside [of a mezuzah] are among those who do not have a portion in the world to come. Not only do these fools nullify the mitzvah, but furthermore, they make from a great mitzvah whose purpose is the unity of the name of the Holy One, blessed be He, the love of Him, and the service of Him, a talisman for their own benefit. They, in their foolish conception, think that this will help them regarding the vanities of the world.”
I think the answer to this contradiction between the Talmud and Maimonides, may lie in the language of the verse, “Patoach tiftach”, open, and it will open. What we do in the world resonates. When we open our hand, or ourselves, to another in some way, we not only impact that person but we tweak the world. We make it a world that is a bit more giving, a bit more caring, a bit more open. Though the Talmud says the reward for mitzvot is not in this world, I think the impact of mitzvot is in this world. What we might personally gain from the mitzvah is not the purpose of the mitzvah, and is not the reward of the mitzvah, but it is an outcome of the this worldly impact of the mitzvah, positive or negative, which each of our actions makes.