When a lien is on an undivided interest or estate of any of the parties, such lien, if a partition be made, shall thenceforth be a charge only on the share assigned to such party; but such share must first be charged with its just proportion of the costs of the partition, in preference to such lien.
SDCL 21-45-27