When you buy stocks or bonds, no one even thinks of taking a deduction for the purchase price. When you buy a building, the story is different. Not all at once, but over a period of years. If it's nonresidential, it's currently 39 years. Other investments don't get this extra deduction.
Depreciation can get pretty complicated.
If you pay for any improvements to the property, you can depreciate them, too. It may look like one building to you, but to the IRS it could be multiple depreciation accounts. Congress is constantly changing the depreciation rules and periods. It can be a mess. But it's worth it.