I would expect similar safety issues at both JHU and Penn, as well as at other urban campuses like USC, Chicago, or Yale.
The campus itself will be quite safe. There will also be a safe “bubble” zone extending several blocks from campus that contains student-oriented housing and services. The bubble may be larger on some sides of the campus, and smaller on others. There will be neighborhoods within walking distance of all of these campuses, but outside of the bubble, that will not be safe, particularly after dark. You will have to learn where it is and is not appropriate to go.
I knew a long-distance runner who went to JHU-Homewood as a grad student, and he had no problems with safety while running off-campus. However, he restricted his running routes to the north of campus, where there are miles of affluent residential neighborhoods. It probably wouldn’t be a good idea to run long distances from the campus in other directions.
JHU has multiple campuses in the Baltimore-Washington area. Presumably the OP means the Homewood campus in north Baltimore, where most of the undergraduates are. The JHU medical campus, a few miles away in east Baltimore, is in a worse neighborhood where the safety rules would be more restrictive.