Does anyone know if it is possible to get a M4A1 legally or some kind of different version that is legal like with the AK?
An M4 is a variant of the M16. M16s are Class III weapons requiring a transfer tax. The average price of any variant of transferable M16 is north of $16K. If you can afford to buy a legal M16, you can configure it just about any way you want, as the lower receiver is the regulated part.
Now, if you want an M4gery, you can do that on an AR15 lower, unless you live in one of the soc1alist states, like California, which prohibits such items. Just buy an M4 upper, an AR15 bolt/carrier assembly, and slap it onto an AR15 lower with a collapsible stock. Voila! Just make sure that the bore from the bolt face to the muzzle, including non-removable muzzle device, is longer than 16 inches. Otherwise you need to pay the SBR tax.
NOTE TO MODS: I have to use a '1' for an 'i' in 'soc1alist' because the cussword catcher thinks I am talking about get-your-pecker-hard drug. Can you fix this?