You point out the classic dilemma of investing an emergency fund. Ideally, you'll never need the money, so why have it invested in a low-yielding money market mutual fund or a money market bank account? The point is you want the money to be liquid, and you don't want to risk these funds.
One solution that I've recommended in the past is to invest in longer-dated certificates of deposit, or CDs, and accept that you'll pay an early withdrawal penalty if you have to take money out of the account. Shop around a little to find the best combination of yield and early withdrawal penalty terms. You can shop interest rates, both in your market and nationwide, on Bankrate. From there, just compare the financial institutions' early withdrawal terms.
A former contender was the Series I savings bond. It always had a three-month interest penalty if you cashed it in within the first five years. But now, with a one-year minimum holding period and a maximum $5,000 purchase limit, it's harder to justify that choice for an emergency fund.
Another option is to construct a laddered CD portfolio. With a laddered CD portfolio, you invest across maturities out to a maximum investment horizon. The different CD maturities are the rungs of the ladder. When the shortest-term CD matures, you reinvest it in the maximum investment horizon. This approach doesn't lock you into one long-term investment and yield, but gives you an average yield over time that follows interest rate trends.
A way to sidestep this issue is to commit $5,000 of your investment portfolio to Series I bonds and after a year has passed, count that money as part of your emergency fund. You'll still pay the three-month interest penalty if you have to cash the bonds in within the first five years of ownership, but you've gained an inflation-indexed investment in your emergency fund. The $5,000 that the Series I bonds replaced in the emergency fund can be reinvested in your long-term portfolio.