On your federal tax return you report all your income, no matter where it is from. For the states, in general, you file a resident tax return for the state you live in, and a nonresident tax return for the other state. Income from another state is subject to tax by that state. All your income is subject to tax by the state you live in, no matter where the income is from. The details of how you avoid paying tax to both states on the same income depend on what the two specific states are, and the type of income - wages on a W-2, self-employment income, profit from selling something in the other state, etc.
The general rule is: your report all your income on your home state return, even the income earned out of state. You file a non-resident state return for the state you worked in and pay tax to that state. Your home state will give you a credit, or partial credit, for what you paid the non-resident state.
If you have income from a state without an income tax (e.g. FL TX), you do not have a non-resident return to file. But you still have to pay tax on that income to your home state.
But as others have said, it matters which two states you are asking about. Some states have reciprocal agreements and a very few do a reverse credit.