You can be taxed in both states, but Pennsylvania should give you a credit for any income taxes paid in New York. You will need to file a New York nonresident tax return and a Pennsylvania resident tax return.
If your employer is based in Arkansas, Connecticut, Delaware, Massachusetts, Nebraska, New York, or Pennsylvania, you must pay income taxes where your employer’s office is located.
If you are a New York State nonresident you must file Form IT-203, Nonresident and Part-Year Resident Income Tax Return, if you meet any of the following conditions:
New York State Department of Taxation and Finance - Filing information for New York State non
Note: Always complete the nonresident return first if filing in multiple states because your resident state might give you a credit for any taxes paid in that situation.