tl;dr: the tax refund is an accounting illusion

Don't bother doing pointless mental math. As long as you don't increase your spending purely because you received a tax refund, you end up at the same point down the line, no matter what you actually do with the pile of money labelled "RRSP-induced tax refund".

Are you stupid? it's definitely better to invest the refund than to spend it

That's true for every source of money. What makes the "tax refund money" special?

Show me the math, I don't believe you

Here you go.