Dont use the visual editor. Copy the code into your ‘HTML’ view and it will preserve indentation. Copy it into ‘Visual’ view and your code will be all left-aligned…
Examples:
Code pasted in ‘Visual’ View
<indent>
<indent>
<indent>
</indent>
</indent>
</indent>
Code pasted in ‘HTML’ View
<indent>
<indent>
<indent>
</indent>
</indent>
</indent>
YMMV, I guess, but this is what works for me.