A lawsuit against the city highlights an affordable-housing program's decades of mismanagement — and the middle-class homeowners who lost out as a result.