You have it backwards. Costs are deducted from income, not income from costs.
Suppose you buy a piece of land for $200,000. You then spend $100,000 building a storage facility. You now have a total of $300,000 in expenses.
You then rent the facility out, getting $12,000 a year. This is gross income. Depending on the situation, there are various deductions you can make from that. For instance, if you got a mortgage to buy the property, you can deduct interest. You can also claim depreciation from the $100,000. This then decreases your cost basis; you can't deduct something twice, so if you deduct depreciation from your income, you can't deduct it again.
So suppose after a few years, you've deducted $40,000 in depreciation. In other words, you've deducted a total of $40,000 from your income over the years you've owned the property.
Suppose you sell the property for $400,000. You have $400,000 in income from the sale. You can deduct your original purchase price of $200,000. You can also deduct the cost of building the facility, but you've already claimed $40,000 of that, leaving $60,000. So your total cost basis (that is, what you can deduct from the sale price) is $260,000, leaving you with $140,000 in profit to pay taxes on.