In DC (where I work a lot), we engage in a lot of very complicated legal antics to make buildings mixed as between market rate and affordable. It's not easy or cheap but when it works it's a great product. A lot of it is driven by certain requirements for land sold by the city.