As rising rents and higher home prices chip away at affordability in cities across the nation, some apartment investors are trying to strike a balance between making money and keeping rents low enough to house millions of middle- and low-income residents.