Recreational flying doesn't fall under the same airspace restrictions as Part 107.
For recreational flying, if you are within 5 miles of an airport then you must notify (not request permission) the airport operator and tower (if there is one) before flying. It doesn't matter what class of airspace you are in - that's all you have to do. You could be in trouble with the FAA for endangering the safety of the national airspace system if you put other aircraft at risk in doing so, such as flying on or close to an extended runway centerline, or fly up into the pattern (typically at least 800 ft AGL), but the airport cannot prohibit you from flying.
Under Part 107 you are entirely governed by airspace rules, which can either be less or more restrictive. For example, near an airport with no surface controlled airspace, you can fly anywhere in the vicinity without any requests or notifications. However, if the airport is surrounded by surface B, C, D or E airspace, then you cannot fly in that airspace at all without prior FAA (not airport) authorization or waiver.