I am not aware of any state regulations that require you to reside in a state for a minimum period of time before you apply for a mortgage. The guideline you referenced for your relative may have been a lender-specific guideline as opposed to a state regulation. Borrowers are typically required to provide two years of residence history when you apply for a loan and if you have not paid for rent or a mortgage for an extended period of time (such as if you lived with a relative) then some lenders may want to see a track record of making monthly housing payments before you can qualify for a mortgage, although this is relatively uncommon. Additionally, this residence history requirement is borrower-specific and not a state regulation.
The issue that lenders typically focus on when you move from one state to another is a borrower's employment history. Lenders typically require that borrowers have two years of continuous employment history to qualify for a mortgage. When borrowers move to a new state, sometime that causes a break in employment that can be an issue when you apply for a mortgage. As long as there is no break in your employment and your job does not have a probationary period then you should be good to go for a mortgage. For example, in your case, transferring cities or states but remaining with the same employer (or even in the same field of work), with no extended break in employment, is an ideal scenario if you move to a new state and apply for a mortgage. We provide a comprehensive overview of borrower qualification guidelines including your debt-to-income ratio, credit score and employment history on FREEandCLEAR.