What you need to know about how banks define a resident.
Banks view residency as where an individual presents their taxes.
For example; it's common for some people to get NIE numbers, Spanish Green cards or more recently TIE's etc for residency in Spain, however if taxes continue to paid in the UK, USA or elsewhere then the applicant will be deemed a non-resident. Where you reside physically has no impact - living in Spain isn't enough.
Mortgages can still be obtained for non-residents but for a lower loan to value (LTV).
A resident can apply for 80% LTV, a non-resident can be 70% LTV (although the 70% LTV is also dependent on other factors).
If you want to become a Spanish resident you'll need to apply, and pass the application process then have two years tax returns are required.