State foreclosure and bankruptcy laws govern the rights of mortgage lenders and borrowers during foreclosure and bankruptcy proceedings and therefore impact on lenders’ exposure to credit risk. This paper seeks to understand the effects of these state laws on the type of mortgages originated. The empirical identification is based on state-level variations in foreclosure and bankruptcy provisions and a border estimation strategy. We find that higher-risk loans (FHA and subprime loans) are more likely to be originated in a state with lender-friendly foreclosure laws. Also, higher-risk loans are less likely to be originated in a state with a more generous bankruptcy homestead exemption. In addition, our results are consistent with the idea that FHA and subprime loans share a very similar clientele and are close substitutes. These results are robust without the ordering assumption among conventional prime, FHA and subprime loans.