It is not Illegal
to program MB Keys, unless they are to be used for illicit purpose. (Well it isn't illegal in UK anyways)
It is however against Mercedes Benz Policies, and they will not endorse the various procedures involved, their way is from the Vin No and via PDC who get the Vehicles allocated Key codes from FDOK Database, then the Key is supplied to the Dealer who supplies Customer.
Don't know if you have specialist locksmiths in USA, they will be able to Program a new (Virgin) Key, but decent ones will still require Proof of Ownership.
In UK there are only 2 firms that I would trust, and they are generally half the price of Main Stealer for a new working Key. Locksmith ~ £180, MB ~ £350
Steer well clear of the backstreet "yeah yeah yeah, we can do that" mob or you will probably end up with a non starting Car with a goosed EIS
There is a guy on here in USA who is a good MB Locksmith, not sure if you are near to him and he can do the job for you,
, or there is another guy
who has successfully repaired non working keys for members here