If the plaintiff claim only on an estate for life in the land recovered, and pay any sum allowed to the defendant for improvements, he or his personal representative may recover, at the determination of his estate, from the remainderman or reversioner, the value of such improvements, as they then exist, not exceeding the amount so paid by him and shall have a lien therefor on the premises, in like manner as if they had been mortgaged for the payment thereof, and may keep possession of such premises until it be paid.