If the visual depiction(s) involved, or any of them or any communication concerning them, or any component of them has been transmitted by the US mail, or in interstate or foreign commerce, or by a facility affecting such commerce, or a person involved has traveled in interstate or foreign commerce as part of the offense then these laws may apply, but not otherwise. Note that the internet may be considered to be "a facility affecting such commerce" even if the internet transmission was within a single state.
Thus if person A creates such an image within the US, and hand-delivers it to person B who is in the same state, or retains it without transmitting it or intending to transmit it, there could be no conviction under federal anti-child-porn laws. This is true only if the image is not obscene under Miller* and is not the image of any real child, so 2251 et seq do not apply. If the image is legally obscene, then stte laws are much lore likely to be invoked.
Note that if a person is found to be in possession of an image of child pornography it is not enough to say that it must have been received from someone. The government must prove that it was received in interstate or foreign commerce, or that at least one of the other restrictive provisions is met (possession with intent to distribute, image or component previously transmitted in interstate or foreign commerce, person involved traveled in interstate or foreign commerce as part of the scheme, etc)
Note also that the "fictional" aspect of Section 1466A, specifically 1466A (c) has been argued to be in violation of the First Amendment, and to the beat of my knowledge there has been no binding court ruling upholding that provision. in United States v. Dean (2011) there were procedural obstacles to a facial challenge, in this first Handley case there was a guilty plea, Audette was never formally charged, and in the case of Christian Bee there was again a plea deal. A case of pure fictional child pornography, with no actual child involved in any way, might well not be upheld under Ashcroft v. Free Speech Coalition.
However, when the image of a fictional child is found to be obscene under the Miller test, then there can be a conviction. Ashcroft v. Free Speech Coalition permitted a conviction for non-obscene images only if they were images of real children. Images found to be obscene lose all first amendment protection, and simple possession of them was permitted by Stanley only as part of the right to privacy, not under the First Amendment. Section 1466A specifically applies only to content that is obscene under Miller. Any interstate or foreign transmission is enough for a conviction for such obscene images.
2008 Handley case
In United States v. Handley, 564 F. Supp. 2d 996 (S.D. Iowa 2008) the U.S. District Court for the Southern District of Iowa wrote:
Defendant argues Free Speech Coalition gave constitutional legitimacy to pornography in which no real children are used. The Court disagrees. Free Speech Coalition dealt with whether the Child Pornography Prevention Act of 1996 (CPPA), specifically 18 U.S.C. §§ 2256(8) (B) and (D), abridged the freedom of speech. Free Speech Coalition, 535 U.S. at 241, 122 S. Ct. 1389. Section 2256(8) (B) banned child pornography that appeared to depict minors but was produced without using any actual children. Id. at 239, 122 S. Ct. 1389. Because the statute criminalized material that was neither child pornography involving actual children under Ferber nor obscenity under Miller, the Supreme Court concluded the CPPA sought to reach beyond obscene material, and the statute was struck down as overbroad and unconstitutional. Id. at 256, 122 S. Ct. 1389.
Section 1466A (a) (1) and (b) (1) do not suffer from the same defect as those found in the CPPA in Free Speech Coalition. Sections 1466A(a) (1) and (b) (1) specifically include as an element of each offense that the material must be obscene. Free Speech Coalition required that the prohibited material fall into one of the categories recognized by Ferber or Miller, and sections 1466A(a) (1) and (b) (1) meet this requirement.
Asa district court decision, this is not binding precedent, but it may well be followed in future cases.
The key federal laws on child pornography are:
18 USC § 2251 (a) and (b) apply only to a person who:
knows or has reason to know that such visual depiction will be transported or transmitted using any means or facility of interstate or foreign commerce or in or affecting interstate or foreign commerce or mailed
18 USC § 2251 (c) applies only if
(2) (A) the person intends such visual depiction to be transported to the United States, its territories or possessions, by any means, including by using any means or facility of interstate or foreign commerce or mail; or
(2) (B) the person transports such visual depiction to the United States, its territories or possessions, by any means
The various subsections of 18 USC § 2252 and 2252A contain similar restrictions to things "mailed, or transmitted in interstate or foreign commerce, or affecting interstate commerce" or onboard US flagged ships or aircraft, or in government facilities.
Section 1466A includes a very similar restriction, that a communication in concerning with the offense must have raveled by the US mail, or in interstate or foreign commerce, or a facility affecting such commerce, or a person involved must have traveled in interstate or foreign commerce in connection with the offense. Moreover this sectio0n applies only to images that are actually legally obscene, unlike 2251 and 225s et seq.