Well, of course incomes have something (a lot) to do with prices. But I guess I interpreted the original question to be directed more towards an apples-to-apples type of comparison, like San Diego vs Austin (not SF vs. Hidalgo County, wherever that poor county might be).
In an apples-to-apples comparison, the explaining factor for high prices is usually land use/zoning. Whenever a city adds people (and both San Diego and Austin have grown mightily over the past decade), an inelastic housing supply (restrictions, regulation, NIMBYs, zoning, etc) inevitably results in a price spike. An elastic housing supply (light regulation, fast approvals) will result in sprawl, but also low prices. Texas is the poster child of very light (non-existent?) regulation, enormous sprawl, and consequently, very low prices.