I learned something new a few years ago, and then I realized that it was new to most people, not just me. This part is not new: when you sell a house, not only do you have to consider federal income taxes on the profit, but you also have to consider state taxes when selling a house. The part that surprised me was that many states have provisions for the estimated taxes to be taken at the time of sale. Sometimes these rules apply to sales by anyone, sometimes these rules only apply to sales by non-residents. This means that the amount of money you take home from the sale of a property could be significantly less than you expect.
For example, let's say you bought a house in Maryland ten years ago and are selling it today. You're a Florida resident, and Maryland has mandatory withholding on 7.5% withholding on the proceeds of the sale by a non-resident. You bought the house for $100,000 and you are selling it for $150,000. In the most simplified version, the escrow company that handles the sale will deduct $3750 from the amount that is paid to you at closing. The escrow company will make that payment to the State, who will apply it to your tax account for the year. When you file your Maryland non-resident tax return at the end of the tax year, that withheld amount will be applied to your overall tax liability (bill) for the year. You may have some or all of the withheld amount refunded to you, if it is an overpayment of your overall tax liability.
The actual math is more complicated than this, but hopefully this explanation gives you the general idea of how the process works.
Every state is different. Some states, as far as I can tell, don't have any sort of withholding requirement at all. Some states only require withholding from non-residents, some states require withholding from all sales. Some state will waive the withholding if the proceeds are rolled over into another real estate purchase. Some states have special rules and exceptions and unique situation.
Now that I've had time to digest it and mull over it and turn it around in my head, it makes sense. If taxes were not withheld at the time of the sale, there would be tons of situations where a person sold a house, and by the time taxes were due months later, there was no money for the (sometimes sizable) tax bill on the profit of the sale. In order to prevent this situation, states may require that estimated taxes be paid, or withheld, at the time of the sale. I'm sure that this process prevents a lot of unexpected, large tax bills that can't be paid.
Because every state is unique, it would require an entire book to explain every state's individual rules. The important thing is to know that the withholding requirement may exist in a state where you own property, and to look for further information about your particular situation. Good resources for answers include real estate agents, escrow companies, real estate attorneys, or tax professionals. You don't want to be surprised at sale time!