When a lien is on an undivided interest or estate of any party, such lien, if partition is made, thenceforth shall be a charge only on the share assigned to such party, but such share first must be charged with its just proportion of the costs of the partition, in preference to such lien.
N.D.C.C. § 32-16-18