Compare like-for-like rates
Compare the effective after-tax investment return with the loan’s effective interest cost, not a headline return against a headline rate. Prepayment is a relatively certain saving; investment returns are estimates and can be negative over shorter periods.