If any tax on any real estate is paid by or collected from any occupant or tenant or any other person, and such tax, by agreement or otherwise, ought to have been paid by the owner, lessor, or some other party in interest, such occupant, tenant, or other person may recover by action the amount which such owner, lessor, or party in interest ought to have paid, with interest thereon at the rate of six percent per annum, or may retain the same for any rent due or accruing from the person who paid the tax to such owner or lessor for real estate on which such tax is paid, and the same, until paid, constitutes a lien upon said real estate.
N.D.C.C. § 57-45-01