That's pretty easily dealt with through residency thresholds. We do this in the UK, counting people resident for tax purposes if they spend more than so many days in the UK in a given year. I would be very surprised if the US doesn't already do this to determine non-citizens tax status.
That's how state taxes are dealt with in the US and a number of people go to great pains to make sure they stay exactly the number of days in some high-tax state that lets them skirt liability. I'd be surprised if similar things didn't happen in Europe but I don't pretend to be as familiar with what goes on there.