From everything I have read into the lore, it's not illegal if a higher authority tasks you to do it. Unless you run afoul of said higher authority's rivals or enemies. Otherwise it is illegal to just randomly decide, "Oh this morning I am going to genetically engineer myself some tentacles and jump out of dark corners yelling suprise!" On the otherhand, if you petition to be assigned to research such a thing, and make sure the petition goes to freindly people rather than hostile ones then your likely to get approval for a wide variety of things that would otherwise be illegal.
I don't think that's quite it. Performing such research is still illegal (or rather heretekal), it's just that being powerful (or having a powerful patron) can protect you from punishment. If you get caught you can still get in trouble, so such research is usually done in secret.
There are also grey areas and rules that contradict each other. For example gene manipulation - where do you draw the line?
The greatest objections seem to be over genetic splicing with Xenos (there's a whole heretical faction mentioned for that one), and inducing mutation. Since the human form is holy, so the Emperor doesn't want you to go adding tentacles, or a set of gills, to it.
But entirely illegal? Well obviously not, otherwise the Genetors and others wouldn't even exist (because the Genetor studies human anatomy and genetics as much as Xenos). While hypocrisy abounds within 40K, it'd be hard to argue against the theory when we have so much evidence to the contrary. Starting with the Space Marines, who argueably get a pass because the Emperor created them himself. But others, such as the Gland Warriors, a wholly successful 'design' of genetically modified human. As well as the less successful Afriel Strain, cloned regiments of soldiers made using the spliced together genetics of many of the Imperium's greatest heroes (from Chapter Approved, they were Guardsmen with Know No Fear, and very bad luck).
While office politics is certainly likely to play a part, even a big part, the real big determiners are probably the things I mentioned above. Messing with the base human form, and/or trying to make it more Xenos.
"Would you like to travel across entire sectors in months, rather than years? Would you like to blast people with warp energy? Would you like to have an extra eye? Come down to Fabius Bile's Gene Emporium, and become a New Man!"