The 5 NM restriction is for recreational users only. Part 107 pilots can fly within controlled airspace, as long as they either an Airspace Authorization to operate in that airspace or a Certificate of Waiver, whichever work best for the pilot (and the operation).