The judgment entered in a foreclosure proceeding under authority of section 2A:50-40 of this title shall be only for the amount of unpaid interest due under the terms of the mortgage to the date of the judgment, and costs, and shall adjudge that the mortgage shall not be deemed to have merged in the judgment, but shall remain in full force and effect as security for the payment of the principal sum then remaining due thereon and secured thereby, and interest upon the principal sum to become due thereon from the date of the judgment.
N.J.S. § 2A:50-41