Can you get a license in a state that you don't live in or own a building in and operate the company from another state?
Generally yes.
As a lawyer, I can be licensed in any state so long as I satisfy their licensing requirements.
As a Franchise Attorney I agree with the other attorney answer. The more important question is why would you want to do that? It would likely entail paying annual franchise and other taxes in both states. Consult with a good business or franchise attorney in your area for specific advice.
Mr. Franchise - Kevin B. Murphy, B.S., M.B.A., J.D.
Franchise Foundations, a Professional Corporation