The lien hereby given shall be preferred to all judgments, mortgages, deeds of trusts, liens, and incumbrances which attach upon the building or ground affected by said lien subsequently to the commencement of the work upon the building, as well as to conveyances executed, but not recorded, before that time, to which recording is necessary, as to third persons; except that nothing herein shall affect the priority of a mortgage or deed of trust given to secure the purchase money for the land, if the same be recorded within 10 days from the date of the acknowledgment thereof. When a mortgage or deed of trust of real estate securing advances thereafter to be made for the purpose of erecting buildings and improvements thereon is given, or when an owner of lands contracts with a builder for the sale of lots and the erection of buildings thereon, and agrees to advance moneys toward the erection of such buildings, the lien hereinbefore authorized shall have priority to all advances made after the filing of said notices of lien, and the lien shall attach to the right, title, and interest of the owner in said building and land to the extent of all advances which shall have become due after the filing of such notice of such lien, and shall also attach to and be a lien on the right, title, and interest of the person so agreeing to purchase said land at the time of the filing of said notices of lien. When a building shall be erected or repaired by a lessee or tenant for life or years, or a person having an equitable estate or interest in such building or land on which it stands, the lien created by this chapter shall only extend to and cover the interest or estate of such lessee, tenant, or equitable owners.
D.C. Code § 40-303.07