I do not know if the fact that you clear US immigration in Toronto has anything to do with the airline knowing. Rather curious that you metioned YYZ-JFK. The only two carriers that I was aware of that actually fly this route direct is Pakistan Airlines and Delta.