The Metropolitan Transportation Authority has spent millions of dollars maintaining its empty former headquarters in Midtown Manhattan ever since a dispute between the city and state stalled a deal to lease the building two years ago, according to agency documents.

The 20-story complex sits on a prime block of Madison Avenue, a stone’s throw from Grand Central Terminal. The MTA spends about $4 million a year maintaining the building, according to the authority’s preliminary budget for 2019.

That...