The MTA thought it was in the best interest of the taxpayers– that it would drive increased traffic/revenues to the other stores in the terminal. Not only legal, but great.
This is New York. It actually would not be surprising if some money passed under the table to get a deal like this, whether Apple directly knew about it or not.
The MTA does what it wants to, regardless of best interests.
Didn't they use to spend millions buying rare artwork as an investment instead of using the money to fix bridges?