I was thinking if there were any analogies to lenses used in still photography. Let's try this: the fineness and quality of the brush used to make an amazing presence, impact and precision of mark on Reeve's Palo Ipso Doubleweight Rag paper, the 80 lb one. Or the quality of the pens and brushes used for calligraphy or the ability to control the mark you make in a finely detailed painting.
In photography the lens is everything. It is your picture's personality, plain and simple. The lens is the most organic in that you react with it, turn it, focus it, determine the depth of field with it, frame with i and set the aperture to boot. The lens is everything.
38mm Biogen on the Hasselblad Superwide circa 1957, the 35mm f2 Summicron for Leicas, the Nikon 14-24mm f2.8, the Goerz Dagors, the 300mm f5.6 Nikon for 8 x 10: legendary lenses, some I have been honored to use over the years. Of course, in analog years, enlarging lenses played a role. This was the second part of making photographs, a crucial step as if they weren't good, you were losing all the quality created by the lens that took the picture. I used Schneiders for many years although I had a 240mm f5.6 El Nikkor enlarging lens for 8 x 10 that I liked very much.
In the early days of lens coatings, there were battles about the coating killing sharpness. Coatings are used to control lens flare. I never saw this.
Falloff, corner sharpness, contrast, pincushion distortion, bokeh, maximum aperture, center sharpness, diffraction, best aperture, lens variability, focal length: all playing a part. Are there excellent lenses that don't cost an arm and a leg? Yes, a few. Are there bad expensive lenses? Yes.
Best, of course, is to test the lens you're thinking of buying first. Shoot some frames with it. See what pictures made with it look like. These days, one option is to rent a lens you are considering purchasing. I did that recently for an expensive Sony G Master lens I was considering.
Used lenses? Yes, possible but be careful. It could have been dropped, shaken out of alignment, or have sand in it making it less than smooth to focus. Best is to buy from someplace like KEH or MPB so you can return it if it's not up to your standards.
As lenses get faster they get heavier and more expensive. One way to save can be by buying a slower lens of the same focal length. Do you really need that extra stop of speed? Maybe not.
Last, I always test a new lens. Even high-end and expensive professional lenses can have inconsistency from lens to lens. A sturdy tripod, no wind, a textured subject that will show you how the lens is doing, shooting at different apertures will usually give you a sense of whether the lens is really good or not.