Unless the new gun had the exact same serial number, they broke the law by shipping it to you.
wrong
§ 922. Unlawful acts
(a) It shall be unlawful-
(1) for any person-
(A) except a licensed importer, licensed manufacturer, or licensed dealer, to engage in the business of importing, manufacturing, or dealing in firearms, or in the course of such business to ship, transport, or receive any firearm in interstate or foreign commerce; or
(B) except a licensed importer or licensed manufacturer, to engage in the business of importing or manufacturing ammunition, or in the course of such business, to ship, transport, or receive any ammunition in interstate or foreign commerce;
(2) for any importer, manufacturer, dealer, or collector licensed under the provisions of this chapter to ship or transport in interstate or foreign commerce any firearm to any person other than a licensed importer, licensed manufacturer, licensed dealer, or licensed collector, except that-
(A) this paragraph and subsection (b)(3) shall not be held to preclude a licensed importer, licensed manufacturer, licensed dealer, or licensed collector from returning a firearm or replacement firearm of the same kind and type to a person from whom it was received; and this paragraph shall not be held to preclude an individual from mailing a firearm owned in compliance with Federal, State, and local law to a licensed importer, licensed manufacturer, licensed dealer, or licensed collector;