Actually it's illegal by Federal Motor Vehicle Safety Standard 571.108.
That is a HUGE spec that controls everything about lighting, bulbs, reflectors, and how they need to be marked. Basically a vehicle and/or lighting system is designed and submitted by a manufacturer. Once the government tests and approves the setup it is meant to be used that way. Putting other bulbs in housings that were not designed, tested, and approved for them is illegal.
Most police departments have better things to do than crack down on this so you see a lot of aftermarket bulbs, etc running around but that does not make it legal.
There is also some really good info behind the reasoning of the spec here:
http://www.danielsternlighting.com/tech/bulbs/Hid/conversions/conversions.html
http://www.danielsternlighting.com/tech/bulbs/superwhite/superwhite.html