Hahah, that's the rub. Being a consultant can be a good way to acquire domain expertise, as long as you are vertically focused: "I solve problems for realtors" rather than tech focused "I build web applications" or "I build mobile applications in Swift". Downside: can be scary to specialize, will take some time.
Another way to do that is to actually do the job or take a job in a company that is not a software company but that uses software. I worked for a real estate brokerage for years and now know a lot about real estate. Downside: again, you have to pick a specialty and will take a few years.
A final way is to do some research and talk to people about their problems. This is much quicker, but will require some work that you won't get paid for. Amy Hoy has some great stuff around researching: https://stackingthebricks.com/