I take that both of them are used, but I don't understand the sentence with 'as'. Many natives said that the two sentences mean the same thing fundamentally, but I don't get it the 'as' part. They said 'as' takes the role of preposition 'like', but doesn't 'like' mean 'in the same way'? If I live a lazy life while my wife works diligently, could I still say "I live under the same roof as a woman"?
The sentence using "with" is incorrect, but often used informally.
Here "as" is used as a preposition in the sense of "introducing a basis for comparison"
I live under the same roof as (the roof that) a woman (lives under).
Means the same as
I live under a roof with a woman.
Since we all live under roofs, this just means:
I live with a woman.
Bringing the roof into the sentence, and mentioning that it is the same roof, are all details that the listener would have assumed anyway, so serve as emphasis.
"You fly airplanes?"
"Yes, with wings and engines and everything."
This particular phrase is an idiomatic way of emphasising this.
If you really want to go crazy with it:
I live under the exact same roof as a woman - we have got a couch, and cushions and a stove and everything.