I also didn’t think a state could tax someones’ income who was just visiting but New York does it to athletes and business travelers.
New York’s budget problem is so extreme that back when the banks were bailed out, both the governor and the NYC mayor were begging the banks to pay bonuses to their staffs - regardless of whether they merited them or not. Both needed the tax revenues so badly; the circumstances were irrelevant. If bailout money needed to be transferred from taxpayers across the country to the coffers of New York state and city, then so be it...
That’s income earned in the state, so it is legal.