A mortgagee, or person claiming under him, may enter on the premises or recover possession thereof, before or after breach of condition, when there is no agreement to the contrary. In such case, if the mortgage is afterwards redeemed, the amount of the clear rents and profits from the time of taking possession shall be accounted for and deducted from the sum due on the mortgage.
33 M.R.S. § 502