Unfortunately not only can neither a Mars nor a moon habitat be made economically productive, no Mars or Moon habitat will ever be built.

I know the non-scientific public think we are going to do all these things in the future, or even that we are right on the verge of doing it now. As such, my answers to these questions may not be popular, but they are the truth. We have been brainwashed by space movies.
No one is going to terraform or colonize these places. We will continue to send robots, rovers and orbiters to these places to study them. That’s it. If a robot dies it’s no big deal. If a human dies it’s a big deal. Sending robots is more cost effective, safer and will continue. Human space travel is an entirely unnecessary expense.
Professor Richard Muller, a physicist from UC Berkeley and author of “Physics for the Future Presidents” has stated it like this:

Most of the universe out there is pretty bleak. The planets and their moons look like exotic but very severe places to visit. They wouldn’t be much fun to explore, except remotely. Unlike the exploration of the New World in the 1500s and 1600s, will be completely dependent on the resources of a major country or company just to survive. It will be a totally artificial survival.It is far easier to create a living quarter on the floor of the Pacific, maybe even in a deep trench, than to live on the surface of Mars. We are not running out of space on Earth. Even Antarctica is far more benign than any planetary surface other than that of the Earth.

I once invited Wally Shirra to speak at a meeting on the exploration of the planets. I had no idea what he was going to say, but as someone who had “been there” I knew it would be interesting. When he spoke, he said that he knew what it was like in space, and that it was awful. Yes, you get some nice views, but space is constantly trying to kill you. He said he had no interest in going back; been there, done that, and it was exciting but exceedingly difficult. He suggested that the best way to explore the universe was with robots, like Voyager, not with people.

I agree. We can do a much finer exploration of Mars and the other planets/moons if we spend the money on advanced robotics, and not on the unnecessary human.