PMI insures the primary loan. If that is a loan to value (ltv) of 80% the borrower does not need PMI on that loan. Secondary loans or seconds can be used to pay down the purchase to 80% ltv – so no PMI, but the borrower pays a higher rate for the second mortgage and everything is fine.
The borrower avoids PMI, the primary lender has their 80% ltv, the borrower only pays the higher rate on the second, not the entire loan so everyone is happy. At least until the default. In a default the first lender get their money first. If anything is left over the secondary lender can get paid. For the secondary lender to foreclose, they must pay off the first lender and work with what is left – hence the higher rate.