When multinational trillion-dollar companies do it, it's purely for greed. Tax avoidance for moral reasons is dubious to start with, but at least ostensibly the motivation isn't the same as what drives thieves and muggers.