When any sale of real estate has been made by a mortgagee, trustee, or other person authorized to make the same at which the mortgagee, payee, or other holder of the obligation thereby secured becomes the purchaser and takes title, either directly or indirectly, before such mortgagee, payee, or other holder of the secured obligation as aforesaid, shall be entitled to any deficiency judgment against the mortgagor, trustor, or other maker of any such obligation whose property has been so purchased, he shall first establish to the satisfaction of the court in which such action for a deficiency judgment is pending that the property covered by such mortgage sold at foreclosure sale for its true market value or more at the time of such sale, and in adjudging any such deficiency the court in arriving at the amount of such judgment shall deduct from the amount of the mortgage indebtedness remaining unsatisfied after the sale of the mortgaged property the difference between the true market value of said property at the time of such sale and the amount for which it sold, if such amount was less than the true market value at the time of sale.
This section shall not affect nor apply to the rights of other purchasers or of innocent third parties nor shall it be held to affect or defeat the negotiability of any note, bond, or other obligation secured by such mortgage, deed of trust, or other instrument.
This section shall not apply to foreclosure sales made pursuant to an order or decree of court nor to any judgment sought or rendered in any foreclosure by action nor to any sale confirmed prior to July 1, 1937.
SDCL 21-48-14