I'm assuming you're talking about
headlight bulbs, not parking light, directional, etc. I'd suggest that there are actually two components to your question. 1) Are they legal and 2) Do you really want to.
The federal government sets standards for auto manufacturers to follow when designing and building vehicles. Some of those standards have to do with lighting. Manufacturers can install LED lighting in vehicles - as long as the final result meets the lighting standards. And that's the rub.
Most folks don't understand that a headlight is actually a
system with a light source, reflector, lens and housing. All of these are designed to work together. Change any one of them and you run the risk of the system no longer working correctly. That's what happens when you install "drop in" LED bulbs in a headlight housing designed for halogen bulbs. Why don't they work correctly even though the marketers say they do? Read this:
Why Most LED Headlight Upgrades Don't Really Work: An Expert Explains
So if it was as easy to convert headlights to LED by simply slapping a different bulb in the housing, why didn't auto manufacturers do it? Because it doesn't work as shown above. And it's not legal for them - even though that would have been a far cheaper way to go - if it actually worked.
Now that we know why one should not install LED bulbs in a housing designed for halogens, why are so many people selling them? Because they can. Or should I say because they
could. There were so many complaints about the poor performance of LED bulbs and the glare they caused for oncoming drivers that the feds finally decided to crack down. Every reputable manufacturer of these bulbs was forced to pull them off the market. Some folks get around it by stating that their bulbs are "for off road use only" though.
In summary, generally speaking, slapping LED bulbs in a housing designed for a halogen bulb will result in a decrease in performance and excessive glare for oncoming drivers.
For those that think they simply need to re-aim their headlights to eliminate the glare for oncoming drivers, I have one question: When you replace your headlight bulbs with proper halogen bulbs, do you have to re-aim them? No. Then why should you have to re-aim them for LED bulbs because it shifts your whole headlight pattern down - reducing your effective range.