That’s not the only way to dim an LED, just the cheapest. Variable current power regulators are the premium option.
A screw-in LED bulb combines LEDs and power regulating electronics. Some of them handle the variable input voltage a household dimmer provides gracefully, but that’s more expensive.