(a) If the claimant records a notice of lien as provided in section 264 of this title, while a notice of commencement is effective, the claimant’s lien attaches as of the time the notice of commencement was recorded as provided in section 262 of this title.
(b) If the claimant records a notice of lien when there is no effective notice of commencement covering the improvement, the claimant’s lien attaches at the time he records his notice of lien.
(c) Except as provided in subsection (d), a construction lien takes priority over a conveyance, security interest, another construction lien, judgment, or other claim against the real estate which was not recorded as provided in chapter 7 of this title or this chapter or perfected as provided in Title 11A.
(d) All liens which attach as of the time of recording the notice of commencement (subsection a) have equal priority and share the funds available in the same ratio as the ratio of the particular claimant’s lien bears to the total of all liens.
(e) “Funds available” in the case of subcontractors, means the total of:
(1) sums paid by the owner to the prime contractor prior to recording of a notice of commencement;
(2) sums paid by the owner in disregard of any notice of right to claim a lien; and
(3) sums unpaid under the prime contract.
(f) “Funds available” in the case of subsubcontractors, means funds available as defined in subsection (e) but not more than the amount to which their subcontractor is entitled.
(g) An owner pays in disregard of a notice to claim a lien if he fails, after receipt of notification of a right to claim a lien, to withhold from the prime contractor an amount sufficient to pay the amount of lien of a subcontractor or subsubcontractor provided for in subsections (b), (c) and (d) of section 256 of this title or pays a subcontractor amounts to which the subcontractor is not entitled because of receipt by the owner of notification of a right to claim a lien from subsubcontractors who have contracted with that subcontractor.
(h) Except as provided in subsection (i), the lien takes priority over subsequent advances made under a prior recorded security interest if the subsequent advances are made after the notice of lien has been recorded.
(i) Notwithstanding notice that the lien has attached, subsequent advances made under a prior recorded security interest take priority over the lien if the advance
(1) was made under a “construction security interest”, or
(2) was applied to payment of the cost of the real estate improvement, or to payment of any lien or encumbrance which is prior to the lien given by this chapter, or to maintenance or preservation of the real estate or of the secured creditor’s interest therein.
(j) A security interest is a “construction security interest” if the instrument recorded to perfect the interest so denominates it, and the debtor incurs the obligation for the purpose of making the improvement, whether or not the proceeds are in fact so used.