Many men who served in the United States Civil War did not enlist in the state where they resided. For a variety of reasons a man may have enlisted in a unit from a neighboring state. The usual reason was to help a state meet its quota or perhaps there was an enlistment bonus that motivated someone to cross a state line.
Don’t dismiss a potential reference to your soldier ancestor simply because he’s from the “wrong” state.
But don’t just assume that a John Miller from Illinois is the same one who enlisted in Ohio because it “could have” happened. That sort of jump is somewhat uncommon and will take some research to prove.