You forgot that we agreed that interest rate is 0%, so you would have to return the same 1000$ (not 950$ as you pretend). But you can only earn 970$. In this case you incur a loss of 30$.
REAL interest rate of 0% implies NOMINAL interest rate of -5% if deflation is 5%. So you pay the nominal interest rate on a loan, which is now MINUS $50 (and which nobody will accord you).