State tax filing

I am asking about the same predicament between living in Boston and working for a company in NYC and I want to make sure I understand you correctly. When you say you file to both states but then MA gives you the "credit" from your NYC taxes paid, that means you're not paying taxes on anything twice, correct? Like you're losing you're money because it's taxes and that's what paying taxes means.... however you're not losing extra money because you're paying it TWICE?   It's just a matter of filing to both and following  the rules via the extra form?