There is a limited supply thanks partly to public housing and rent control (people never leave and developers basically can't touch it), and also it's incredibly expensive to develop in NYC:

"A 2010 study by the Association for Neighborhood and Housing Development estimated that covering the cost of financing, building, and operating a new apartment building in New York City, including taxes, required a minimum rent for its units of $2,100 per month. To live comfortably with such rent, a family would need an income of at least $86,000. Further, developers become understandably unwilling to construct apartment buildings where they can’t be assured of such rent premiums. The high construction costs result not only in inflated rents in new buildings, therefore, but in an overall shortage of housing, which drives up the price of already-constructed unregulated units.

And it’s New York’s tentacular state and local government that helps make it so wildly expensive to build. The NYU study found a host of government policies that drive construction prices higher. For starters, city agencies responsible for overseeing and regulating building were often openly hostile to new construction, the study discovered. “The Buildings Department is still one of the major drivers of the high cost of housing in New York City, rather than an agency dedicated to reducing expense and facilitating development,” the report observed. Even experienced builders, the study found, now typically employed well-paid “expediters” to move their projects through the city’s foot-dragging approval process, adding an average cost of about $200,000 per building.

Taxes and fees tied specifically to development—many of them rare in other cities—are another factor in Gotham’s sky-high building costs. For example, New York levies a transfer tax on land when a developer buys a plot, and then a mortgage-recording tax when a builder borrows to finance his project. And the builder faces significant sales taxes on construction materials, too. For a hypothetical New York apartment building, going up on a plot of land bought for, say, $5 million, real-estate, mortgage, and sales taxes would add $1.6 million to the development price tag.

New York’s local and state elected officials also write laws and codes that curry favor with various special interests with a financial stake in development, raising prices higher still. Litigation-friendly New York State makes it easy to sue builders and developers, for instance, which benefits construction-worker unions and trial lawyers, two powerful Albany lobbies, but makes insurance on the construction of an apartment building as much as 8 percent to 10 percent of total costs—twice the national average. The Scaffold Law may be the most striking example of this kind of legislation. Unique in the country, it mandates that a developer or contractor is completely liable if an employee gets injured on a job site, even if worker negligence played a role. Even workers found to be drunk on the job have won big judgments.

Another costly government barrier to building is the city’s excessive fondness for historic preservation. Initiated in the mid-1960s as a way of protecting truly exceptional structures—a fallout from the unfortunate demolition of the original Penn Station—the city’s landmarking process has morphed over time into a way for local activists and progressive politicians to stymie development of any new construction in neighborhoods often all but devoid of historic value. Nowadays, notes Harvard economist and City Journal contributing editor Edward Glaeser, nearly 16 percent of buildable land in Manhattan resides in historic-preservation districts, and about half of it is largely off-limits to development. (See “Preservation Follies,” Spring 2010.) In a city desperately needing housing construction, the preservation districts lost an average of 46 units of housing per tract during the 1990s, according to Glaeser’s research. Not surprisingly, the cost of housing in these districts has risen substantially faster than in other areas of the city."[0]

[0] http://www.city-journal.org/2014/24_3_nyc-government.html