The developer. Bought the property for 3.1 million and will be selling first floor and basement to the congregation for 3 million.
Not commenting on this case as I know nothing about it, but the above alone doesn't mean that the shul isn't profiting or that the deal isn't fair. If the true value of the newly-built space is higher than the true value of the current land+building, then the shul comes out ahead.
The process of one party contributing land and the other party building a new building and giving some space back to the landowner is something that's been done commercially in a legitimate manner elsewhere, in deals that have both parties come out ahead.