If you're purchasing a home, you, the buyer, get to say what inspections you want done. Inspection contingencies are very common in those transactions, and in that case, the mortgage lender will want to make sure that the inspections were completed and accepted by the buyer / borrower.
Normally, the only thing a conventional mortgage lender requires is a home appraisal by a licensed appraiser, and that's mainly to determine the property value. But there are exceptions, and I'll explain here.
Sometimes an appraiser will note something that prompts a lender to require an additional inspection. For instance, I once closed a loan in which the appraiser noticed some barrels of what appeared to be toxic substances on the property. He reported that the barrels appeared rusty and that the substance could have leaked into the ground, possibly causing contamination, So the underwriter required the removal of the barrels and confirmation that their contents was not toxic.
In homes with septic systems or private wells, lenders may require water tests, or that the septic tank be pumped and inspected. It depends on the location (areas with diminishing water tables or those near possibly hazardous sites), and if the appraiser notes something like unexpectedly wet areas on the ground surface.
Fannie Mae, for example, says that, "When the lender has reason to believe that private well water that is on or available to a property might be contaminated as a result of the proximity of the well to hazardous waste sites, the lender is exercising sound judgment if it obtains a “well certification” to determine whether the water meets community standards."