Historically, the government has been concerned about situations in which the sale of a building would generate a terminal loss, while the sale of the land would generate a capital gain. The government is not keen on you claiming a full deduction for the building terminal loss while only including half of the gain on the land in your income. An extreme example would occur if you demolished the building and therefore generated a terminal loss, and sold the land at a capital gain.
Accordingly, the Income Tax Act has a rule that re-allocates the proceeds of disposition when you sell a building with a terminal loss and the related land at a capital gain. Basically, the proceeds from the land are re-allocated to the building to bring the terminal loss from the building down to zero. But the re-allocation is limited to the amount of the capital gain from the land.