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.)
It's not hard to see why school shootings happen. It's the point of frustration/anger/lashing out for these people. Just like "going postal". People attack the area/group/place that causes them the anger/frustration. Then add in the notoriety that they'll get with it and it's the obvious answer for young minds. The ultimate "Ill show you".
Thanks Mark...I stand corrected.