Why didn't the government just take the gold for itself and use it on buying resources and stuff wouldn't that have been a better idea?
The gold of the California gold fields - as it was understood in 1849 and the early 1850s - was an extensive resource, meaning that it was broadly distributed in small amounts. It took tens of thousands of people to process hundreds of thousands of tons of dirt to find the gold they were seeking, and at that, $4 - roughly a quarter of an ounce - was considered a good day.
The General Government (as the US federal government was known) did not have the resources - human or otherwise - to work the gold fields and process all that material. Most miners were only making a living wage to do the work and very few people ended up with surplus wealth. If the government had nationalized the gold fields, which is what you're suggesting, it would have had to pay all those workers, and it would not likely have profited much.
By the mid 1850s, California miners were seeking underground "intensive" gold deposits in the form of gold veins. These were concentrated, but their retrieval required a great deal of technology and supplies as well as skilled labor. Again, the government could have nationalized the mines, but it would have been a tremendous challenge to harness the people and to find the money to invest in a highly speculative, risky undertaking. It was best left to the private sector to shoulder the cost and to take the risk.
Because of all this, the national mining acts of 1866 and then, 1872, outline an approach to mineral resources, particularly on federally managed land. Because the risk of failure was so great, the federal law basically offers the resource to anyone who can find it and develop it. The perceived common good was in the mineral wealth being pumped into the economy and in the development of remote locations in North America. Although there have been many attempts to amend the generous aspects of the 1872 Mining Law, it remains the statute that governs mining to this day: it has not been possible to built a consensus around any alternative.
Hey there,
Just to let you know, your question is fine, and we're letting it stand. However, you should be aware that questions framed as 'Why didn't X do Y' relatively often don't get an answer that meets our standards (in our experience as moderators). There are a few reasons for this. Firstly, it often can be difficult to prove the counterfactual: historians know much more about what happened than what might have happened. Secondly, 'why didn't X do Y' questions are sometimes phrased in an ahistorical way. It's worth remembering that people in the past couldn't see into the future, and they generally didn't have all the information we now have about their situations; things that look obvious now didn't necessarily look that way at the time.
If you end up not getting a response after a day or two, consider asking a new question focusing instead on why what happened did happen (rather than why what didn't happen didn't happen) - this kind of question is more likely to get a response in our experience. Hope this helps!