There are many well-documented anomalies in finance. Among them is the surprisingly small return that investors historically have earned for taking credit risk in fixed-income markets—the default premium, as measured by the difference in returns between long-term Treasurys and long-term corporate bonds, has been only about 0.3%—and that stocks with a higher risk of defaulting on debt have produced lower returns.Going back to 1988, which is as far back as Barclays breaks down the returns of the Long Corporate Bond index into the contribution from credit and rates ex the spread, the return from the credit component has actually been slightly negative at -0.09% annualized vs the 8.12% return for a like duration Treasury bond. A similar story plays out in intermediate corporate bond space, where the credit spread contributes only 0.37% of the 7.24% return for the Barclays Corporate Bond Index since 1988.
The story is more nuanced than "credit always underperforms the yield" as yield is generally a great predictor of future returns, but yield should generally be viewed more as the ceiling for future returns than actual future returns. The issue is when there is stress in the market, such as during the financial crisis when 13 year cumulative performance (the rough duration of the index) of long corporate bonds underperformed the yield's "predicted" return by almost 80% (the 13 year forward performance starting in 1995 ended during the 2008 meltdown).
My general view of credit is to avoid it unless you feel you are being more than fairly compensated. Even if you miss shorter periods of relative outperformance (vs treasuries), allocating only when credit looks like a screaming buy will likely result in a much better long term return profile. In the case of long corporate bonds, allocating only when the spread of long corporate bonds to treasuries was greater than 200 bps (something that occured just 20% of the time), returned 1.1% annualized more since that same 1988 start.