Wrong, tax optimization is legal. You are free to legally reside in a country with no income tax. Yet, you should remember that using unfair and/or illegal means for tax optimization and tax reduction purposes is treated as tax evasion, and the latter is illegal.