With a 0.03% difference, it doesn't make a lot of difference. That being said, it depends on your financial situation. Some things to consider:
- Repaying the loan early or investing the money into cds such that the cash flow from the cds matches the cash flow to the loan repayment is almost equivalent. In the corporate world, this would probably even qualify for accounting defeasance, which would allow you to keep the debt but removing it from your balance sheet. This is just an illustration of how accounting wise, both situations are pretty equivalent
- keeping the loan outstanding and the cash invested vs repaying early gives you option. If you do the former, you always have the options to do the latter later. Whereas if you repay the loan early, it is a definitive action. So there is an advantage to not repay early. You can always wait and see. If you invested in bonds instead of CDs, you could even potentially benefit from movements in interest rates.
- your return on investments might be 5% at your current level of assets, but your marginal return might be different. As an example, someone with only 10k to invest might not be able to bear much risk and only be limited to bonds. 100k and it opens the door to a diversified portfolio of stocks and bonds. At 1M they are qualified investors and have access to more options. So even though your whole portfolio might give 5% return now, every dollar you add on top opens the door for potentially more returns. If you use money to repay loans, you are shaving off the dollars that would have brought you the highest expected marginal return.
This is generally not advisable, as it would mean you are likely to end up selling during a market downturn, at a significant discount.
Willingness to take risks is one thing but ability to take risks is another one. In you case, since you need the funds in case of emergency, your ability to take risks is 0.
So your options are limited to riskless assets such as CDs, govt bonds, savings accounts, etc.
As you grow your assets and portfolio, naturally, some part of your portfolio will be invested into bonds, and some part into equity. In that situation, you will be able to count the bonds portion, specifically riskless ones, as part of an emergency fund, provided they are liquid and of small duration. But in the meantime, savings account would probably be the way to go