That adage is false. I'm routinely amazed at how unchallenged it goes when it's so obviously and demonstrably false. People just won't stop repeating it.
You want to own the gold mine (ideally with plentiful reserves that you can extract at a competitive cost). You want to own the oil / oil rights.
The mining majors do dramatically better than the companies selling mining equipment, during a gold rush / commodity boom. The comparison isn't close.
The big oil companies do dramatically better than the oil equipment sellers/makers during an oil price boom.
When oil hits $120 it's not the equipment makers suddenly making the most money. It's Exxon, as they watch their annualized profit hit $50 or $60 billion, which is more than every oil industry equipment maker on the planet combined. And that's just Exxon, you've got a dozen other big oil companies rolling around in a similar profit explosion. And have you noticed the oil majors very rarely go bankrupt? They not only benefit the most during the gold rush, they tend to endure.
The so called pick & shovel makers / sellers are among the last to benefit during a boom, they have mediocre pricing power 99% of the time (except for a five minute peak during a commodity boom), and they're among the first to get smashed when the gold rush turns against them. They're left sitting on inventory they can't move, frequently go bankrupt because of it, and most of the time have mediocre margins (they're almost always selling a quasi commodity low-value product with numerous competitors). If you're going to sell a commodity, it's best to be selling a high-value, high-demand commodity and be a first tier position (meaning you own the commodity). It's also ideal if it's difficult to compete, meaning it costs a lot of money to bring new supply on-line (which is true in mining and oil extraction); and then if there are some cartels that help to regulate over-supply, that's a big bonus. You'll find pick and shovel makers / sellers have few protections, are far easier to compete with, and there are no juggernaut cartels (much less superpowers and major nation states) propping up their prices.
Most major industries have tiers of benefit, or pyramids of value. You want to be in the first / top tier, which is owning the gold mine or oil. The shovel makers are several value tiers down.
An example of how this works (and it's pretty similar in most industries): the alcohol beverage industry. The top tier is Anheuser-Busch InBev and other big makers, they have the strongest position, best margins, are able to dictate terms to the tiers below them in most cases, and pull the most profit out of the system. Next down you have agencies, that handle things like marketing, advertising and distribution. Then you have suppliers of low-value commodities, the pick & shovel makers, that provide eg cans, bottles, cardboard, and some manufacturing equipment. Depending on the industry, occasionally tiers swap a position (in some industries the equipment makers - eg in the semiconductor industry - may be more important than helper agencies, but they're never first tier regardless). Next down, at the bottom, you have retailers (whether Walmart or independent liquor stores), they get the final little itsy bitsy crumbs of margin, and are constantly under pressure every which way on pricing. Margins almost always weaken as you go down the tiers, and pricing power does as well.
The oil industry works that way. The mining industry works that way. The shovel makers are not anywhere near the top.
If you get to choose, you want to be in the position of Intel or TSMC, not Applied Materials or LAM. You want to be Apple, not Foxconn or the company selling lower value pieces of the phone. You want to be Visa, not the company manufacturing plastic card blanks for Visa; you want to be Coca Cola (own the brand), not the company selling aluminum cans to them. The first tiers in the pyramid extract far more value on average than the shovel makers.