The turnaround was not immediate. A year after Ravitch’s tax plan was enacted, annual subway ridership dropped below one billion. But before long, as the system gradually became safer, more reliable and less unsavory, it started to trend up. By 2015, ridership had hit 1.7 billion, a level not seen since the late 1940s.

The rejuvenation of the subway has been intertwined with a protracted period of staggering economic prosperity — agglomeration at work. New York rebuilt the subway, and the subway rebuilt the city. It was one of the great urban renaissance stories of our modern era. But now that the city is thriving, it faces another challenge, perhaps an even greater one: how to spread this staggering wealth more evenly. The subway might again be a central part of the solution.

If the story of the subway is the story of density, it is also the story of land — and more to the point, the story of land value. Before the first tracks had even been laid, real estate speculators were gobbling up farmland and empty lots along the proposed route and then quickly flipping their parcels at huge premiums to builders. When the subway recovered from its last major crisis, it again began throwing off enormous returns for the owners of the land above it. From 1993 to 2013, the average price for a co-op or condo in TriBeCa rose from $182 per square foot to $1,569. In the process, prime real estate in Manhattan was transformed from a place where people lived and built businesses into a high-yield investment in which absentee owners parked their money and watched it grow.

As Manhattan’s business-district centers became denser and its scarce real estate more expensive, the growth started to spill out, following the subway’s snaking lines across the river, into Brooklyn and Queens. “Developers build things where the subway works, and we build far fewer things where it doesn’t,” Jed Walentas, the 43-year-old principal of the real estate development company Two Trees Management, told me recently over lunch at a cafe in Dumbo, Brooklyn’s answer to SoHo. “We put density where there’s transit.” Walentas, who was wearing the familiar Brooklyn uniform of jeans, New Balance sneakers and a blue hoodie, and his father, David, own a good chunk of Dumbo, an investment that has made them rich — house in the Hamptons, vacations heli-skiing — beyond the wildest dreams of most New Yorkers.

I’ve known Walentas since the early 2000s, when I rented a desk in one of his many buildings in the neighborhood, a turn-of-the-century factory that has since been converted into multimillion-dollar condominiums. This is pretty representative of Dumbo’s overall trajectory over the last two decades. It’s a stark transformation that would have been impossible to predict when his father first started buying up the neighborhood’s underutilized properties in the early 1980s, before it was widely known as Dumbo. What enabled it to happen wasn’t just the neighborhood’s excellent subway access — it’s sandwiched between the F line and the A line — or the city’s economic recovery, or even the exodus of rich people priced out of Manhattan by even richer people. The transformation of Dumbo required something much simpler: a change in the zoning law. For years, the neighborhood had been restricted to only manufacturing uses, a legacy of the city’s losing battle to retain industrial jobs in the 1960s. In the late ’90s, Walentas and his father were able to persuade the city to jettison these old rules and allow them to completely remake the neighborhood, filling old factories with loft apartments, design-and-tech-centric offices, retail stores, artists’ studios and new condo towers. In the subsequent 20 years, as the neighborhood changed, average condo prices rose from $200 per square foot to more than $1,500. More recently, Walentas has pushed north into Williamsburg, leveraging similar rezonings there to turn a former textile factory into the trendy Wythe Hotel (near the L train) and a 19th-century Domino sugar refinery (J, M and Z) into three million square feet of office space, retail stores, parks and apartments.

Like most good-government tools, zoning sounds boring, but it is in fact a secret means by which cities are shaped and fortunes are made. If the subway delivers density, zoning determines where that density goes by doing things like placing limits on how tall buildings can rise or how many dwellings they can contain. New York’s zoning codes are byzantine, the product of years of pushing and pulling between the desire to allow the city to evolve and grow and the impulse to keep development in check. These codes have helped preserve the city’s historic buildings and neighborhoods while preventing its streets from being forever cast into darkness by endless rows of skyscrapers. But they have also had the effect of restricting the supply of housing, which has driven up prices, especially in neighborhoods with desirable buildings and good subway access. “I rent studio apartments for $3,400 a month,” Walentas told me. “It doesn’t make any sense.”