My biggest gripe about this phrase is the fact that the idea conveyed does not match reality. The idea behind this advice is to reuse what is already out there and not create you own implementation of something. One problem with this, is every implementation of an idea will have a different set of tradeoffs associated with it. You may have a wheel that is able to work on nearly any terrain, but is dangerous to use at high speeds, or a wheel that is long lasting but costs more money. Certain situations will require you to create your own individual wheel, that is unique to your own needs.
One of the important tradeoffs that needs to be considered is how much you need to understand how the wheel works and how much additional customization you will need to perform to it. When considering these ideas, you start to consider a wheel factory, rather then just a wheel. When you have a wheel factory you can produce a range of different types of wheels to fit your own set of needs. By building the facotry yourself, you gain additional knowledge of not only how the factory operates but how wheels are created. Knowledge of the facotry allows you to make the most use out of it, while knowledge of wheel creation and the wheels themselves can be applied in any situation where wheels are required. The process has added value to your skill set.
Of course, building the factory can be time consuming and resource intensive. The best way to minimize the cost is to only build the bare minimum. After this you will have more knowledge on how to improve it or make additions when the need arises, but until that need arises, nothing extra should be done.
The only time the advice to not reinvent the wheel is useful is when someone is blindly tries to make one, without investigating what is already out there and considering if the time would be best spent learning how to use it. And lets just reinvent the phase to be don't reimplement the wheel, which is what is really meant.