Right - the difference between the two is that deductions and tax credits are explicitly entered into the law to define what someone should be paying. The corporate tax rates that Apple pays in California are instead a reflection of the law's inability to effectively extract the money that society wants to - loopholes are involuntarily, while tax deductions are intended.
Of course it's often intended for a tax deduction to be okay. I'm not quite sure what the thrust of your argument is - are you trying to imply that loopholes as a concept are invalid?