If the amount found due to the defendant for improvements exceeds the amount found due from him for rents and profits accruing within six years, he shall be chargeable with rents and profits accruing before that time, so far as necessary to balance his judgment for improvements; but in such case he shall not be liable to repay rents and profits in excess of the value of the improvements.
Mass. Gen. Laws ch. 237, § 27