There were audible groans and boos when Apple (AAPL 0.09%) revealed the price of its Vision Pro mixed-reality headset will be $3,499. But few investors are balking at the price of Apple stock, which is once again flirting with a $3 trillion market cap.

Shares of Apple hit an all-time high price ahead of Apple's big announcement earlier this week at its World Wide Developers Conference (WWDC) in California. The shares have outperformed both the S&P 500 and Nasdaq Composite indexes by a wide margin year to date. Meanwhile, its valuation is touching levels not seen since the end of 2021, when it last sat near $3 trillion, despite an outlook for a revenue and earnings decline in 2023.

Is Apple getting too expensive for both investors and consumers?

A hefty price tag

Apple shares peaked above a forward P/E ratio of 30 to start the month of June. That's a higher forward P/E than the last time Apple shares traded around the $3 trillion market cap mark.

The culprit is expectations that Apple's revenue and earnings per share will decline over the next year. Analysts currently expect a 2.3% decline in EPS and a 2.5% decline in sales for Apple. The Vision Pro won't sway those numbers: The device won't come out until 2024 and probably won't have meaningful sales until fiscal 2025.

Over the last 15 years, Apple shares have traded at a trailing P/E above 30 for nine months during the height of the COVID-19 pandemic and then briefly again near the end of 2021. With its current P/E of 30.4, it's starting to look quite pricey again.

AAPL P/E Ratio Chart.

AAPL P/E Ratio data by YCharts.

Is Apple worth it?

Despite its high price tags, Apple's products (and its stock) are typically worth the price. While the Vision Pro's value may still be up for debate, the stock still looks like a good deal despite the P/E ratio climbing above 30.

Apple's stock price is supported by the pile of cash sitting on its balance sheet. As of the end of the second quarter, Apple had $166 billion in cash and securities on its balance sheet. While it used debt to access that cash, it still had just $107 billion in debt on the balance sheet, leaving it with $59 billion in net cash. Meanwhile, it's generated nearly $100 billion in free cash flow over the past year, and the outlook remains strong for it to keep the cash machine running.

That consistent cash flow and massive stockpile on its balance sheet gives Apple a lot of room to keep buying back shares of the stock and support its stock price. It bought back $39 billion worth of stock in the first half of 2023, and the board authorized a new $90 billion share repurchase program in May.

The consistent sales of iPhones and the growth of Apple's high-margin services business are the reasons to buy Apple. It's a cash cow that allows it to return massive amounts of money to shareholders while still investing in products for the future, like Vision Pro. So, even if Vision Pro is an absolute overpriced flop (which I don't think is the case, for the record), Apple will walk away largely unscathed.

Even at today's high price, Apple stock is worth buying.