If taking it back to Virginia, you pay Virginia tax.
If you lived in CA and bought in CA, you would pay CA tax. If you then moved to another state (within a certain timeframe---which I don't remember what that is), you would then owe the new state the difference between the tax rates (if CA tax was less than the new state).
At least that's how I remembered it.