benefit the pledgor, whereas in this case the pledgor does benefit, because the effects of the work remain and the benefit accrues to everyone: to the pledgor, because his property has been restored; and to the pledgee, because his security remains intact—for had it collapsed, he would have been left with nothing.
Some scholars drew a distinction, saying: If he restores only what is sufficient to secure his debt, he may recover the cost; but if he restores more than that, he may not, because there is no necessity for him to rebuild beyond what is needed to secure the debt. Thus, if two rooms had collapsed and repairing one of them would have been sufficient to secure his debt, but he rebuilt both rooms, he may recover the cost of the first but not that of the second, except for the materials alone. This view is a middle position between the two opinions: namely, that the pledgee may recover only the amount required to secure his debt. The reasoning is that whatever exceeds this was not rebuilt to preserve his right, but went beyond that.
Some scholars say: If leaving it—meaning, leaving the collapsed portion unrepaired—would cause the rest of the house to collapse, and this is a real possibility, such that if he left the collapsed part unrepaired the entire house would fall down, then in that case he may recover the full cost, because this was done to preserve the whole house. But if the remaining part of the house would not be affected by what had collapsed, then the distinction mentioned above applies.