They made about 40B net income in 2023 (that’s right, net) despite spending billions on the metaverse. They have more than enough money in their war chest to do moonshot ideas.
Metaverse was an obvious failure, but Quest is a huge success in the VR/AR market. They managed to create high quality products without it becoming overpriced novelty items (eg Valve Index, Vive, Apple Vision), while being an open ecosystem that supports OpenXR and sideloading.