There is no universally "best" growing method — each of the three main options solves a different constraint, and the right choice depends on your soil, budget, and how permanent you want the garden to be.
In-ground: the lowest cost, if your soil cooperates
Free if your existing soil is workable and well-drained. The tradeoff is that poor native soil — heavy clay, contaminated urban lots, or extremely rocky ground — makes in-ground growing genuinely difficult without years of amendment.
Raised beds: the middle ground most beginners land on
Higher upfront cost than in-ground, but you control the soil completely from day one, drainage is rarely an issue, and the soil warms faster in spring. The main downside is the ongoing cost of topping off settled soil, discussed in more detail elsewhere on this site.
Containers: the most flexible, most demanding of attention
The only option that works on a balcony, patio, or rental property where digging is not an option. Containers dry out faster than any other method and need the most frequent watering — often daily in hot weather — which is the tradeoff for their total flexibility.
A reasonable default
If your native soil is reasonably good, start in-ground and save the money. If it is not, or you are renting, raised beds offer the best balance of cost and control. Reserve containers for spaces where nothing else is physically possible.
Soil Warming Speed: An Underrated Raised Bed Advantage
Raised beds warm up 2-3 weeks earlier in spring than in-ground soil, since they sit above ground level and drain excess moisture faster — a genuine advantage for gardeners in shorter-season climates wanting to extend their effective growing window on both ends of the season.
Containers: Best for Testing, Not Always for Yield
Containers offer the most flexibility for testing a location's sun exposure or trying a new crop before committing to a permanent bed, but generally produce lower total yield per plant than in-ground or raised bed growing due to more limited root space and faster moisture fluctuation.