The difference is that to buy shares your bank will not lend. However for
property it will. A good investment apart from its returns should always be done on borrowed money.
Here lies one of the Spanish problem. To borrow you need to notarise the loan, pay taxes & if you need to revise the terms of the loan you incur this cost again. This discourages the borrower to invest & as a result the economy suffers as wealth does not get created. The banks end up squeezing you for silly charges of €1 here & there.