Upvote:2
You will pass through immigration on arrival in New York.
Consider: The flight from New York to Charlotte will be full of Americans who are traveling internally in the USA and have not brought their passports. (Most Americans don't have a passport). There would be no way for the authorities to single you out for checking as you leave that plane, without checking everyone, which should not happen for a domestic flight.
So the universal rule is that you need to pass immigration inspection before you get to mingle with people who are already in the country. (In fact, the US follows the even simpler rule that everyone landing on an international flight will be checked, no matter where they're going afterwards).
Depending on which airport in New York and the time of day, 2.5 hours could be cutting it close -- but if your tickets are on a single booking, the airline will put you on a later plane to Charlotte if you're delayed by immigration lines.