How is the final total federal depreciation deduction on the sale of a residential rental property calculated?

I sold a residential rental property in Maryland as a non resident, while earning money in NY and living in NJ. The sale price was $650,000 and the net gain on the property sale after additions and subtractions was $411,000. MD withholdings at the settlement were $28,996. For some reason there is a large federal depreciation deduction of -$761,100 (on the MD fed/state adjustment summary worksheet). Maryland form 505SU Part 1 line BB thus shows a net subtraction modification to MD income of -$785,716. The result is a net negative income in MD and I don't owe any tax on the sale. This seems strange.

Does anyone know how the large federal depreciation deduction is determined? I can't find any clues anywhere.

If it helps, NYS IT-398 also shows a large federal depreciation deduction of -$799,166 (on  this amount includes $38,166 of accumulated federal depreciation).