It depends. NY does tax remote workers when they do not meet the convenience of the employer rule (see link below). In order to not be taxed by NYS, you must meet either the primary factor or at least 4 of the secondary factors AND 3 of the other factors listed. If you DO, then you would need to file a NY Non-Resident return claiming $0 income on your return and the full amount of taxes withheld to get a full refund.
If you do NOT, then you will need to file a NYS return and pay NYS taxes. When you file you will file your NY non-Resident return first and then file your resident return. Your resident state will give you a credit for taxes paid to NY, but MD will not give you a refund if you paid more taxes in NY than you would have owed in MD, you will just not need to pay additional taxes if MD has a lower rate than NY.
New York Convenience of the Employer Rule
**Say "Thanks" by clicking the thumb icon in a post
**Mark the post that answers your question by clicking on "Mark as Best Answer"