Avoiding taxes is sound business. If a public company failed to avoid avoidable taxes, it would have a problem with its board and shareholders. Illegally evading taxes is a crime, and I'm not aware of any criminal prosecution of Apple for tax evasion.