No it is not legal. Epic will not permit it as you are forbidden to sell editor tools that link directly against editor parts of engine. What you can do is make your product and then make specialized build of editor specific to your product to create mods for example (you must distribute the engine build for free think). That was done numerous times. ArkKit, RoboRecall, some bus simulator…