On a June morning in 2012, New York bank examiners paid surprise visits to the offices of Ocwen Financial Corp., the biggest non-bank mortgage servicer.

That break with tradition—examiners typically set up appointments in advance of inspections—was ordered by Benjamin Lawsky, superintendent of New York’s Department of Financial Services. A year earlier, Lawsky had approved Ocwen’s purchase of Litton Loan Services on the condition that the new owner fix Litton’s mishandling of foreclosures. Now Lawsky’s examiners in Houston, Texas, and West Palm Beach were checking to see if Ocwen had kept its promise.