§ 1371. Deficiency judgment. 1. If a person who is liable to the plaintiff for the payment of the debt secured by the mortgage is made a defendant in the action, and has appeared or has been personally served with the summons, the final judgment may award payment by him of the whole residue, or so much thereof as the court may determine to be just and equitable, of the debt remaining unsatisfied, after a sale of the mortgaged property and the application of the proceeds, pursuant to the directions contained in such judgment, the amount thereof to be determined by the court as herein provided.
2. Simultaneously with the making of a motion for an order confirming the sale, provided such motion is made within ninety days after the date of the consummation of the sale by the delivery of the proper deed of conveyance to the purchaser, the party to whom such residue shall be owing may make a motion in the action for leave to enter a deficiency judgment upon notice to the party against whom such judgment is sought or the attorney who shall have appeared for such party in such action. Such notice shall be served personally or in such other manner as the court may direct. Upon such motion the court, whether or not the respondent appears, shall determine, upon affidavit or otherwise as it shall direct, the fair and reasonable market value of the mortgaged premises as of the date such premises were bid in at auction or such nearest earlier date as there shall have been any market value thereof and shall make an order directing the entry of a deficiency judgment. Such deficiency judgment shall be for an amount equal to the sum of the amount owing by the party liable as determined by the judgment with interest, plus the amount owing on all prior liens and encumbrances with interest, plus costs and disbursements of the action including the referee's fee and disbursements, less the market value as determined by the court or the sale price of the property whichever shall be the higher.
3. If no motion for a deficiency judgment shall be made as herein prescribed the proceeds of the sale regardless of amount shall be deemed to be in full satisfaction of the mortgage debt and no right to recover any deficiency in any action or proceeding shall exist.
4. Notwithstanding the foregoing provisions and irrespective of whether a motion for a deficiency judgment shall have been made or, if made, shall have been denied, the court shall direct that all moneys remaining in the hands of a receiver of the rents and profits appointed in the action, after the payment of the receiver's fees and the expenses of the receivership, or any moneys remaining in the hands of a mortgagee in possession or an assignee of the rents and profits of the premises, shall be paid to the plaintiff to the extent of the amount, if any, by which the judgment of foreclosure and sale exceeds the amount paid for the property upon the sale.