Federal. GCA 1968, IIRC. It limits purchases of firearms from dealers to 21 or greater, but carves out an exception for long guns and 18-year-olds.
(IIRC, you can buy a pistol or a receiver in a private sale at 18 in CO, or at least before requiring every transfer to go through a FFL.)