All land outside the original 13 states was originally owned by the federal government. Its sale paid for much of the government during the first few decades.
Then to encourage faster settlement they began giving it away as homesteads.
Don’t know about all states, but at least in MO the government was still selling off a lot of land in the early 19th and as late as the 50s/60s.
Most federal land in the West was available for homestead, mining claim or purchase thru the mid 20th. That it stayed in federal hands was mostly because nobody wanted to buy it. Or at least not under the terms available.
I’ve spent a LOT of time in the West. Most of the BLM land, anyway, is not worth much as land on which to earn a living. Obviously mineral rights makes a difference, but most land in the West away from water just isn’t worth anything from a productive POV.
Much of it IS beautiful. But then much of it also bears a close resemblance to a construction site on which work has been interrupted.
One Indian War officer was asked about the territory he was going through (lava beds, IIRC) and he said it "Looked like Hell with the fire gone out." A pretty apt description of some areas in Eastern Oregon and Idaho.
A lot of this property management business comes from the Theodore Roosevelt era. The whole disagreement between Taft and Roosevelt goes back to an executive order that Roosevelt gave toward the end of his presidency....while Taft ended up having to undo, because it was mostly illegal.