The Rama at the beginning of Hil Pesach writes that there is a minhag to provide wheat for matzah to the poor before Pesach. Who is entitled to these public funds? Any poor person who has lived in a city for a year. The Magen Avraham, however, cites the SM”K that our practice is to distribute ma’os chitim to anyone who has lived in a city for 30 days.
The Mkor Chaim (link) asks: why did the MG”A bring his proof from the SM”K when the Rama himself in Hil. Tzedaka (Y.D. 256:5) mentions this 30 day cutoff?
The answer is that ma’os chitim is not a din in hilchos tzedaka, but is a unique tax that is part and parcel of hilchos pesach.
Rav Zolti in his Mishnas Ya’avetz (O.C. 7) expands further on this idea. The Rambam writes in Hil Y.T. 6:17-18 that simchas Yom Tov demands not only eating a festive meal with one’s own family, but providing food and drink to the poor as well. The Rambam does not place this halacha in Hil Matnos because it is not simply another detail that falls under the usual umbrella of hilchos tzedaka, but in a facet of how we celebrate Yom Tov.
Nafka minah: where one only has enough for one’s own sustenance, there is no obligation to give tzedaka. However, even when one barely has enough, one must borrow to enhance one’s celebration of Shabbos/Yom Tov. Since providing for the poor falls under the obligation to enhance Shabbos/Yom Tov, it would necessitate even borrowing funds to fulfill.
We saw the same idea in our discussion of matanaos la’evyonim in hil. Purim. The Bach paskens that even a poor person who otherwise is exempt from mitzvas tzedaka must fulfill the mitzvah of matanos la’evyonim. Here too, we see that matanos la’evyonim is part and parcel of the mitzvas ha’yom of simchas Purim, not simply a detail of hilchos tzedaka.