It is not expressly stated in the tax code or the regulations, but you see it in the case law (court decisions). You get the right result when you apply fairly straightforward tax principles. I'll give an example. Amy wants to sell her property to Bill. The property is worth $200,000 and Amy has a mortgage on the property for $125,000. Amy's basis in the property is $150,000.
Consider two ways of doing the same transaction. It helps to first look what the result would be with an all cash transaction first, then compare that to what the transaction looks like with assumption of the debt.
In the first version of the transaction, Bill borrows the money to buy the property and gives a check to Amy for $200,000. Amy then pays off her mortgage at the closing, leaving her with $75,000 in cash at the end and she no longer owes the mortgage. Her capital gain on the property is $200,000 cash received less her basis of $150,000 = $50,000 gain.
In the second version of the transaction, Bill gives Amy a check for $75,000 and fully assumes her loan with her lender, thus relieving her of liability for it. Amy is in exactly the same position after this transaction as she was in the first, she has $75,000 cash and no longer owes the mortgage. By assuming the debt, Bill has done the same thing as if he gave her a check for $125,000 and then Amy paid off her mortgage with that cash. Thus the tax law treats this exactly as if that is what happened: the $125,000 of debt assumed is treated like additional cash in the deal to Amy. So what Amy got out of the deal was $125,000 from the debt Bill assumed + $75,000 cash for total consideration of $200,000. Her gain then works out the same as above: $200,000 in consideration received less $150,000 basis = $50,000 gain.
Since Amy ended up in the same position in both transactions — she has $75,000 in cash and does not owe the mortgage anymore — you would expect that the tax results should be the same too. And that is exactly how it works out. That way, there is no tax incentive to structure it one way over the other. The parties can structure the deal either of the two ways that works best for them but whichever one it is, the tax consequences are the same.