When a judgment is rendered in an action authorized by chapters 601 to 631 against any house, building or appurtenances, wharf, pier or building on a wharf or pier, and the land on which it stands, or any interest that the owner of such house, building or appurtenances, wharf or pier has in such land, the property must be taken and sold on execution in the same manner that rights of redeeming mortgaged real estate may be taken and sold. If 2 or more such judgments are rendered at the same term of the same court, the court shall direct in writing on which execution the property must be sold, and in that event, and in the event that the officer holding any execution recovered under chapters 601 to 631 is notified in writing by any lienor who has caused the property to be attached or who has filed the lienor's action claiming a lien as provided, that the lienor claims a portion of the proceeds of the sale, that officer, unless all owners of such judgments and all lienors so notifying such officer otherwise direct, shall sell the property and after deducting the fees and expenses of sale, shall return the balance into the court of highest jurisdiction in which any such lien action is pending or in which such a lien judgment has been rendered, and the court shall distribute the fund pro rata among the lienors who shall satisfactorily prove their right to share in the same. The court issuing execution on which the sale is made may fix the time within which the owner has the right to redeem the property from such sale. The court distributing the fund may make such decree in regard to costs as is equitable. Any balance not required to pay such lien claims and costs must be paid to the person or persons legally or equitably entitled to the balance.
10 M.R.S. § 3265