You can live in Spain for example and work and generate revenue and pay taxes within you country of origin. I think the criteria is you're officially living and working where you spend more than 50% of the year.
So I know people that spend less than 50% in a different country, and making revenue and paying taxes within their country, legally.
So I know people that spend less than 50% in a different country, and making revenue and paying taxes within their country, legally.