You can use the variable org-src-preserve-indentation. If you set it to t before tangling like this:
(setq org-src-preserve-indentation t)
then the tangle will work as you expect.
The variable is defined with a defcustom so it is meant to be customized as you wish. You can either set it in your init file as above or ...