What is a purchase-money mortgage, and how does it work?

What is a purchase-money mortgage, and how does it work?