Risk is one factor, but not the only one. The main factor in low-risk investment returns is time preference. In essence: People are willing to pay rent (interest) in exchange for access to money now rather than later. Those with savings can earn a profit by renting out their accumulated savings even in a risk-free scenario where return of principle is 100% guaranteed.
[1] https://corporatefinanceinstitute.com/resources/knowledge/tr...
/thread closed
While yields over the past year have been rather low at about 2% due to some very unusual circumstances, and T-bill rates are essentially negative at a mere 0.17% nominal yield, US corporate AAA bonds have a long-term average effective yield of over 4%[0] with essentially no chance of default. This is considerably higher than inflation and nearly risk-free to the investor. These corporations could instead have saved up the amount of the payments and had that money at the end of the bond period, but they wanted the money now rather than later, and that is why they're paying you interest.
[0] https://ycharts.com/indicators/us_coporate_aaa_effective_yie...