Yes, liens placed on encumbered property transfer with ownership of the property, because a person cannot remove a lien from a property simply by transferring it. If that were the case, people would just take out large mortgages to buy property and then get rid of them by transferring the property. The same would go for egress and ingress rights.
No, liens that are placed on encumbered properties transfer with ownership of the property. I think that the bank takes the losses when they take over ownership of the property. But when a new buyer comes in to buy a foreclosed home for instance, they do not have to deal with the debts of the place.
Most liens on property must be satisfied before ownership of the property can be transferred. For example, mortgages must be paid off during the sale of a property. There are exceptions. Some liens can be assumed by the new owner as long as the lienholder and perspective new owner(s) agree. The obligation to satisfy the lien would then pass to the new owner.
Property can't be transferred if there is a lien on it. The property must be sold so the lien can be satisfied with whatever proceeds are gotten from the sale of the asset. Liens are made against people who own property at the time and most liens prohibit the transfer of assets without a sale in the future.