It’s the same beach as in the sentence “We stayed on the beach in Miami”. When someone says that phrase in English they mean staying in an accommodation that is located or fronted by a beach. Not that they were camping sleeping on sand dunes in a sleeping bag
Native Australian English speaker here: I would 100% interpret that as they camped on the beach because that’s an option at some places here. Goes to show how it’s cultural I guess.
But if you imagine it said in a fancy accent by someone holding a stack of bills totaling $4000USD does it change the meaning? “On the beach” has to be in very posh accent.
Does it? In my mother tongue "to the beach" means the place with sand and water, not the accommodation.