If you step foot inside the dealership in California, you pay CA sales tax. If you see the car online, and they ship it to AZ (or any other state) for delivery outside of CA, then you pay state sales to to whichever state you register the vehicle.
Although it's common for dealerships to circumvent the laws, it's sales tax evasion if the consumer does not pay sales tax in the purchasing state if the consumer is or was physically in the dealership prior to or during purchase.
This is my understanding after working in that industry for over 6 years, but that was a couple of years ago, and I am no expert. Hope this helps.