A lien document relating to a real estate transaction and containing a written provision securing the repayment of future advances, whether or not the lien creditor is obligated to make such future advances, has priority over all subsequent encumbrances to the extent of all sums advanced, with interest thereon, with the same effect as if the entire sum had been advanced at the time of the creation of the lien.
N.D.C.C. § 35-01-05.2