A cheap apartment building in an existing middle class neighborhood will bring down home values. The perception is that apartments (particularly cheap apartments) bring in undesirable people who will tear up the neighborhood and steal stuff.

A fairly expensive apartment building, catering to young professionals, can increase home values in a neighborhood. Bring in young people with money, and they want places to spend that money. Existing homes in the neighborhood are in higher demand because there's more cool stuff around.

It appears there's a certain income level, below which apartments are seen as "bad". Above that level and they don't have the same negative perception.