Laws vary by state. In NYS you need only pay sales tax on the firearm if you are purchasing it from the dealer or if it is being transfered from another dealer within the state (i.e. you order it from Wholesale Guns and Ammo on Long Island and have it shipped to B&J Shooting Supply in Albany).
Now, it gets interesting if you order it from a dealer within your state and have it transferred by another dealer within the state. By law they are supposed to charge you the tax rate of the county you reside in, not the rate at the retail location (counties within NYS often have different rates in addition to the state's 4% rate). Of course, the retailer will charge the rate at his retail location because it is easier for them to maintain records that way. Doesn't make it right, but it is reality.
You are liable for sales tax on the transfer fee itself as this is a taxable service. Most dealers however are not aware of this.
Lastly, if you do not pay sales tax on the transaction you are obligated to remit what is known as "use tax" at a rate equal to your local sales tax rate. It is not the retailers responsibility to collect this, it is your's to send it to the state.
In case anyone is wondering, I am a political consultant in NYS and have worked extensively with the NYS Department of Taxation and Finance on these very issues.