This also happens a lot more then your told about in the UK as well so it's not confined to one country or one place.
As for Spain it's not so hard to see whats happening on the squatter front, think how many people have lost everything, respect, money, houses, have become homeless and seen all these empty houses all around them and thought "Here i am Spanish and no home, while Jonny Foreigner has one in my country".
How many immigrants, illegal or otherwise, have arrived with no house, no money and again had a look around at the empty's.
One gets away with it, tells the friends how easy it is, and before you know it...Well you do.
Pretty much the same with house break ins, I have no money, or goods, you have them...I want them.
It would get a little better if everyone had a home, work and money, but as we all know for the many it's just another way of having an easy life of the backs of others.