Depending on if this occurred after the passage of the Youth Handgun Safety Act, the clerk may have been misapplying an ATF interpretation related to that (applying it to a long gun when it only applies to handguns).
In short, the Youth Handgun Safety Act generally prohibits the possession by or transfer of handguns to persons under 18 with exemptions for (or to be transferred to temporarily) a handgun/handgun ammunition in certain very limited circumstances. Specifically, the minor must: (1) have written parental permission from a parent who is not a prohibited possessor under federal/state/local law (must be be in juveniles possession along with handgun) and (2) possess the handgun only for employment, farming/ranching, target shooting, hunting, or an instructional course.
(Other exemptions exist for military service, titular transfer via inheritance (but not physical possession), and for handguns taken up for self defense within the home or at an invited location)
ATF instructed dealers that handing a handgun to a person under/ allowing a person under 18 to examine a handgun was not covered under any of the exemptions, and that doing so would be a violation of the Youth Handgun Safety Act (a felony).