Section 59. A mortgagee in possession shall be considered a proprietor for the purposes of this chapter; but if the action is brought against the mortgagor before his right of redemption has been foreclosed, he shall also be liable for all amounts so due on account of his share of the mill, so far as the same have not been recovered from the mortgagee. All amounts paid on this account by the mortgagee shall be allowed, between him and the mortgagor, as so much paid for repairs or improvements.