Read it for yourself:
https://sgp.fas.org/crs/misc/R42346.pdf
Also, during America’s growth between 1781 and 1867, the federal government
acquired all land extending to the Pacific Ocean by
purchases from various foreign countries, including France, Britain, and Russia, and through the
ceding of land by
treaty after the Mexican War.
During the later 19th Century, Congress passed laws authorizing the disposal of (some, but not all) federal lands to private citizens or businesses and individual states. Some lands were sold to fund military wages or reduce the national debt. In the 20th Century, there was a shift in policy culminating in the Federal Land Policy & Management Act of 1976, whereby the remaining federal lands would stay under federal
ownership, but managed by agencies on their behalf.
Over the years, federal
ownership of land has been legally established from a combination of ceding by treaty, purchase or conquest; exchange with or transfer through condemnation proceedings; and purchase under military acquisition laws.