I have always thought that US securities were considered nearly risk free as the government will almost always pay them back. So why is it the case that investors currently view short term securities as more risky than long term ones?
In general a longer maturity rate is practically speaking as equally profitable as a series of short maturity rates compounded. So for example, investing for 1 year thrice is as equally profitable as investing for 3 years. Investing for 6 months 16 times is as equally profitable as investing for 8 years. There is no certainty of equality and you can make money if you guess correctly. If there are many guessers then near equality will be realized.
The U.S. Treasury short maturity yield is higher than some of the long maturity yields (today), not because the short maturity investments are riskier. It is because the very short term rate (overnight) set by the Federal Reserve is high enough that the 3 month rate is higher than the 10 year rate. In other words, the expected mean rate for the next 3 months is higher than the expected mean for the next 10 years. Sometime in the future there might be a recession and the Federal Reserve might want to lower the overnight rate to help the economy. Sometime in the future the Federal Reserve might increase the overnight rate to reduce inflation. Both these considerations form expectations.
In addition to overnight rate setting, the Federal Reserve has engaged in other activity that influences Treasury rates. The Federal Reserve increased its holdings of Treasury bonds in the period from 2008 to 2014. These economists (Gagnon and others) in a paper titled "The Financial Market Effects of the Federal Reserve’s Large-Scale Asset Purchases" estimated that these purchases have been a downward force on long term rates.
The graph shows that those holdings have been decreasing since early 2018 so there might be reason to think that any downward force on long term rates is now not what it used to be so if we see a rise in those rates there is reason to think of causes that are apart from a change in risk perceptions.
Addendum: @Michael rightly points out that market participants bidding up long term bond prices is another force that lowers long term bond yields.
There is another answer by H20NaCl that largely covers this question. I just wanted to add extra material.
One standard way of looking at observed nominal rates for bonds that are deemed to be free of credit risk is to split the nominal into two parts: an expected rate, plus a term premium. The expected rate is equal to the compounded short-term rate over the lifetime of the bond.
Although there is a consensus that this description makes sense, there is disagreement on how to decompose rates. The following link takes you to a page at the New York Fed that describes one method, and also has background material: New York Fed term premia page.
As for the question, the inversion just implies that the expected path of rates was headed lower - which is exactly what happened from the time of the question. Normally, term premia increase with the bond maturity, but this was not enough to prevent the inversion. This matches the description in other answer. There was a debate in the comments about other factors influencing bond yields, but those are normally framed as affecting the term premium.