Nobody can answer this question without knowing which state since state laws are different in this regard.
In California for example, whose name is on the deed is not important. What is importnat is where the downpayment is coming from; how the couple pay for the mortgage, whether there is written declaration in recording to assign the property as one's separate property, among other things.