Visas, residency/rental restrictions, curfews, noise ordinances, non local surcharges, resident member beaches (membership fulfilled by residency), or a hundred other things
Edit: example: in palm springs, you cannot have any outdoor music or elevated noise as a non resident.
If you do, you can be evicted from your rental same day
Visas only work for UK tourists side they aren't in the EU; Spain and Germany are both in the Schengen Zone so there isn't even a border to check for passports. Also, because Spain is in the EU, it may not be legal for them to provide pricing that discriminates between locals and EU tourists.
You can try to restrict the rental supply or make the area not as fun for tourists, but you can't just put up a border unless you want to leave the EU.