If property is sold and granted, and as part of the same transaction the purchaser gives a mortgage or deed of trust to secure total or partial payment of the purchase money, the mortgage or deed of trust shall be preferred to any previous judgment or decree for the payment of money which is obtained against the purchaser if it recites that the sum received is all or part of the purchase money of the property or otherwise recites that it is a purchase money mortgage or deed of trust. This section is applicable regardless of whether the mortgage or deed of trust is given to the vendor of the property or to a third party who advances all or part of the purchase money.
Md. Code, RP § 7-104