What is the ceiling to prohibited space P-47 (or any other P-zone)?
Special Use Airspace is defined by boundaries in all three dimensions1. The horizontal boundaries are depicted on the chart as you describe. The vertical boundaries are in the sidebar of the chart:



You can see here that P-47 exists from the surface (because there's nothing before the "TO") up to 4800 MSL. KAMA is at at 3607 MSL, so P-47 ends 1200' above the airport surface. At a little more than 5 NM away from the airport (measuring on the sectional), that's about 240 ft/NM climb: well within the performance capabilities of almost every powered aircraft. Overflights on the victor airway obviously have no problem at all.

This is used for allowing traffic where it might otherwise not be possible: Consider P-40 and R-4009, above Camp David in Maryland. When the President is not in residence, R-4009 lies exactly on top of P-40. P-40, from the surface to 5,000, is a no-fly zone. R-4009, from 5,000 to 12,500, can be transited with ATC permission.

(1)There's always an exception: see R-2933, over Cape Canaveral: 5,000 to UNLIMITED.