Up to how much money must one spend to purchase a Mezuzah?
One is required to spend up until 10% of his money in order to fulfill a positive command. Possibly, one must spend up to 20% in order to purchase a Mezuzah for a room that he is living in. However one is not required to spend a large amount of money [which is more than 33% or even more than 20%], even by a passing Mitzvah, just as is the law regarding Tzedaka that one should not give more than 20%. However some Poskim rule that by the Mitzvah of Mezuzah, one must spend even more than 20% in order to purchase it.
Mezuzah Versus Tefillin:
If one cannot afford to buy both a Mezuzah and Tefillin, he should buy Tefillin rather than a Mezuzah, being that Tefillin is a Mitzvah fulfilled with one’s body and thus holds greater importance. However this only applied during times that one would wear Tefillin throughout the entire day, or even today, if one is unable to borrow a pair of Tefillin for the time of Davening. However if one is able to borrow a pair of Tefillin for Davening, then in today’s time’s purchasing the Mezuzah receives precedence, as one cannot borrow a Mezuzah.
 Rama 656/1
 M”B 656/8 in name of Beis Yosef and Rabbeinu Yerucham just as is the law by Maaser of Tzedaka
 M”B ibid, as perhaps by a Mitzvah Overes one must spend up to 20% and only by a Mitzvah that is not Overes, such as Tzedaka is one not required to spend more; See Biur Halacha 656/1 “Yoser Mechomesh” that explains the ruling of Rabbeinu Yerucham and the question of the Beis Yosef on his ruling.
 M”B 656/7
 Rama 656/1
 Minchas Chinuch 423
 Rama 285/1; Michaber Orach Chaim 38/12; Admur 38/11; Yerushalmi Megillah;
 The reason: Perhaps the greater importance lies in the fact that it refines one’s body, as opposed to the mitzvah of Mezuzah which does not refine one’s body as much.
 Admur ibid; M”A 38/15