negative basis and assumed liabilities (tax question)

If I transfer a building worth 10 to a closely held corporation, and the building has a mortgage attached worth 12, the journal entry from the corporation’s point of view is as follows: Building DR 12 Mortgage CR 12 Common Stock CR 0 Why do we add the negative basis to the building’s value?