If the mortgagee, or other owner or holder at that time of such bond or other obligation and mortgage, shall refuse to accept payment when so tendered, and assign, as aforesaid, the mortgagor shall have the right to apply by petition to the court of common pleas of the county in which the mortgaged premises are situate, setting forth the fact, and praying for an order, which the said court is hereby authorized to make, upon notice to the parties interested, after hearing, upon the mortgagee, or other owner or holder of the said bond or other obligation and mortgage, and judgments entered thereon, if any, to the mortgagor or his nominee, on the payment of the debt, interest and costs to the date of such tender, if any: Provided, however, and be it further enacted, if the said mortgagee, or other owner or holder of the said bond or other obligation and mortgage, shall neglect or refuse to comply with and obey the order of court, so made, the mortgagor shall, upon proof of such refusal, thereupon by further order of court be released and forever discharged from any further personal liability upon the bond, or other obligation accompanying the said mortgage, to the mortgagee or other owner or holder thereof, their heirs, executors, administrators or assigns; and that any judgment then or thereafter entered upon the said bond or other obligation, or upon the said mortgage, shall, by virtue of such order, be confined and restricted in its lien, effect and operation solely and exclusively to the mortgaged premises.
21 P.S. § 736