How to fix pitched floors in a brick building
Huge RED FLAG !  5 or more inches of floor displacement is a condition for serious concern. There are a number of reasons that could cause this condition. If you are not experienced in structural inspections, I'd highly recommend getting an inspector or structural engineer in there before you buy a serious problem.

The fact that it is also sharing common walls with other units complicates some repair scenarios. Get a pro in there and also get quotes based on the engineer's recommendations.