Patrick, tell me more about this "essential nexus". How would this relate to us here in Boston, where the Mayor dictates (appropriate choice of words) that developers designated up to 13% of new residential units as "affordable" in any new construction? That's not a law, it's just something he tells them they have to do. Either that, or put money into a jar from which the city can spend the money elsewhere.
Building housing doesn't inconvenience anyone who lives around the housing, it doesn't inconvenience anyone who lives in the city, so how can he demand they do this, other than he's the one in charge of giving out permits?
Quick disclaimer -- this is not legal advice (sorry, had to include that)
Sometimes towns and cities require a builder to give something in return for approval of their project. This "something" can be required by the ordinance itself (say, minimum parking), or it can be on a case by case basis (like a new park to make up for developed open space). Either way, the courts have said that in order to NOT be a constitutional taking of private property (which the city would have to pay for), the exaction must have (a) an essential nexus to the development (meaning it must be related to the burdens imposed by the project) and (b) it must be roughly proportional to those burdens. In other words, you minimum parking requirements exist because new development increases traffic, and the minimum parking requirements for a convenience store can't be a new parking garage (which would not be roughly proportional to the increased need).
Other types of exactions include an "in lieu of" fee. So for example, in Portland, we have the ability for developers to reduce minimum parking fees if they instead pay into a trust fund "in lieu of" providing them. The proceeds of that fund must be spent on sustainable transportation (to reduce traffic, the need for the spots in the first place) and cannot be spent on the other side of town from the development (because that would not be related to the development's impact). This is an impact fee of sorts.
Another type of exaction/impact fee is known as the "linkage" system, in which a community links downtown development to broader community goals, including affordable housing. Boston has been doing this for years, since the 1981, well before mumbles (he is still the mayor, right?). In fact, it was a pioneer in the field, being one of the first three major cities to adopt this. It is arguable that, as you said, new development is not really related to displacing the poor (although in many cases, that is its exact effect). So I see your frustration (especially because the added costs are passed on to the consumers, and this makes the project less viable). However, remember that overall a city as a whole is probably better off with its poor integrated throughout, rather than all placed in DOT or wherever the poor neighborhoods are.
Also, if a developer were to challenge an ordinance in place for such a linkage system, what would they look like in the public eye? They would be labeled the profit hungry corporate folks from "out of town" who want to make a buck and beat their feet. It might not be worth the legal fees (this would be a precedent setting legal issue, so chances are both sides would go all out, and it might just be worth it to pay for the moderate income units and get on with it...just like paying off the mayor, which is how its done overseas). Also, the developer usually places these units in the lower levels, and recoups costs by having higher units with better views. Moreover, these days "affordable" might be occupied by attorneys and other well educated college grads (most of whom don't have jobs).
Lastly, some states have requirements that a zoning ordinance be consistent with a comprehensive plan, and some states require an aspirational goal of 10% for new housing. If the plan adopts this goal, the zoning must be consistent with it. I don't know what Massachusetts is like, however, so if you are really interested in it, I would consult an attorney (and I can recommend a few good ones in real estate and planning from Boston if you would like their contact info).