The U.S. economy is grappling with several challenges such as rising inflation, increasing interest rates, and worsening S&P 500 earnings estimates.

In an inflationary economic environment, it makes sense for retail investors to invest money in the stock market instead of parking it in cash. However, investors should also focus on picking fundamentally strong stocks with robust cash flows that are capable of withstanding the current recessionary pressures. Cash flows enable a company to fund its operations and growth initiatives without resorting to expensive debt. Additionally, cash flows can be returned to shareholders as dividends or share repurchases.

Here's why Nvidia (NVDA 1.27%) and Microsoft (MSFT 0.59%), two tech companies with strong cash flows, could be attractive buys now.

1. Nvidia

Nvidia ended its fiscal 2023 (ended Jan. 31, 2023) with $3.8 billion in free cash flow, significantly lower than the $8 billion in free cash flow in fiscal 2022. While the weakness in PC and data center markets affected Nvidia's free cash flow in fiscal 2023, it is expected to surge on the back of increased artificial intelligence (AI) chip sales in the coming years.

Nvidia's graphics processing units (GPUs) -- used mainly for accelerated computing in high-end video gaming and data center segments -- are playing a major role in powering the ongoing AI revolution. Nvidia is said to be one of the major AI chip suppliers used for training the hugely famous ChatGPT language learning model. It is further estimated that over 30,000 of Nvidia's A100 GPUs may be required to commercialize ChatGPT.

To further maintain its technological lead, Nvidia launched the high-end data center GPU H100 chip -- which is reportedly 4.5 times faster than the A100 chip.

Nvidia accounts for over 80% of the discrete GPU market and over 90% of the enterprise GPU market. According to HSBC analyst Frank Lee, Nvidia will also benefit from higher pricing of AI GPUs, which are priced 10 to 20 times higher than average gaming GPUs. Further, once macroeconomic conditions settle down, the company is also expected to see surging chip demand in areas such as cloud computing, automotive, gaming, and high-end PCs.

Nvidia is currently trading at nearly 151 times earnings, while the tech-heavy Nasdaq Composite is trading at only 21 times earnings. While the company's valuation may seem very expensive, high-growth stocks almost always trade at higher valuations. The company is also committed to returning value to shareholders, as is evident from the $398 million in dividends paid and $10 billion of shares repurchased (with $7.2 billion remaining on its current authorization) in fiscal 2023. Hence, this tech stock may prove to be a good buy now.

2. Microsoft

Technology behemoth Microsoft generated $57.4 billion in free cash flow and returned $41.5 billion to shareholders as dividends and share repurchases in the 12 months ending the third quarter of its fiscal 2023 (ending March 31, 2023).

There are also several other factors that make this company an attractive buy. The stock is currently trading near all-time high levels, thanks to the company's partnership with OpenAI (the company that designed the viral ChatGPT chatbot which has an estimated 100 million active users). Since 2019, Microsoft is said to have invested $3 billion in OpenAI. The company is also reported to have plans to invest an additional $10 billion in exchange for a 49% stake in OpenAI.

Microsoft has launched a ChatGPT-powered version of its Bing search engine, which is aggressively taking market share from Alphabet's Google search engine. According to a recent report from The New York Times, leading smartphone maker Samsung may be considering replacing Google with Bing as the default search engine for its devices. This implies that there may be a significant spike in the company's advertising revenue in the coming years.

Increasing demand for generative artificial intelligence technology is driving demand for higher amounts of high-performance computing power to train these large language models. Further, increasing adoption of AI-led applications across enterprises will further boost demand for high-performance computing, which can prove to be a strong growth driver for Microsoft's Azure cloud. The company has already introduced Azure OpenAI Service to enable its customers to use large language models for various enterprise-grade use cases.

Microsoft managed to surpass consensus revenue and earnings estimates in the most recent quarter. While the difficult macroeconomic environment may continue to affect Microsoft's near-term prospects, its medium-term growth outlook seems bright. The company is highly profitable and generates loads of free cash flow. Based on these factors, patient investors can consider taking a small stake in Microsoft stock now.