P: If you do create a level editor, I recommend letting it share code from your game engine instead of writing totally separate code just for it.
Agreed, shared code is a very good idea.
You can also sometimes even build the editor as part of the game (lots of shared code!), depending on the project. However it takes a bit of discipline / modularization to stop the editor code interfering / complicating the game code, which is the trade off against the ease of 'getting something working'.
In my current 2d project I just change a #define and rebuild and it builds as the editor - switches off the game logic, adds menus and functionality for moving objects around on maps / changing terrain, loading / saving maps etc.
This isn't always feasible though. 3d levels in particular are often made poly by poly, rather than by just moving pre-built assets around. This is a much more complex editing task - and for this kind of thing level builders are more likely to use 3rd party software, like 3d studio max, maya, brush-based world editors etc, perhaps with plugins / conventions for adding game specific stuff. They may also do things like import the 3d levels into another editor (for adding more gameplay elements, pre-processing etc) prior to use in the game.
But when it comes down to it, the level itself is data, rather than 'part of the program', so it's usually (99.9% of the time) best to load it from a separate file rather than try and hard code it into the program itself.