If it appears by proceedings in such action or if the court shall determine, that there are any existing liens or encumbrances on the estate, share or interest of any party named in the proceedings, the court shall, if sale is ordered, in the order or judgment for sale direct the officer or commissioners, as the case may be, to bring into court and pay to the clerk thereof the portion of the moneys arising from the sale of the estate, share or interest of such party, after first deducting therefrom the portion of the costs, charges and expenses to which it shall be liable.
N.J.S. § 2A:56-19