The US spent about $30 billion on the space race (which is a couple of hundred billion in today’s money).
It did so in the context of the Cold War and for the bragging rights associated with getting there first (ahead of the Russians).
It cost an astronomical (lol) sum of money and accordingly, even against the backdrop of the Cold War, never really enjoyed huge public support in the US (although it was backed by a small majority of Americans for some time).
Once the first landings occurred, public support for further trips dropped off fairly quickly (which is understandable, the mission having been accomplished).
So it should, really, be quite obvious why other countries haven’t subsequently made similar trips. The cost is prohibitive and there’s little political will.
The UK, for example, is one of the richest countries in the world (albeit not US rich)….but can you imagine if the Tories or Labour had, over the past few decades, ran on a manifesto that included spending billions on establishing a space program, so that some British people could also go to the moon for no particular gain? Do you think that would have been a popular vote winner? Would you have supported it?