They may work in Spain, be asylum seekers (or families thereof) or "displaced" persons in which case they will either be paying into the system or have their payments made for them. The rules are the same for everyone in Europe. When you become resident, you have exactly the same access to the health service as the Spanish do.
The difference in UK is that they treat anyone who is "domiciled" there regardless of whether they have paid into the system or not which is exactly the same for British people in UK. You can go to any country in the EU and, if you become resident, have exactly the same rights as a national. However, most countries insist you pay into the system first (in Germany everyone has to have insurance for example) and Spain is no different. Asylum seekers (those applying for it and those granted it) are given free treatment in any EU country. Those working and paying into the system in Spain will also receive free treatment for themselves and for their families (regardless if only one person is working). I'm sure these "rumanians, morrocons ect" are on the system one way or the other.
Interestingly, though, the Alicante region health authorities reckon some 20% of people they treat for "emergencies" are British who, falsely, use the EHIC to gain treatment even though they live in Spain. They are, therefore, accessing treatment to which they are not entitled as they have not paid into the Spanish system.