The hammering is caused by a damaged cartridge filter. Specifically, the plastic weld holding the inner section of the filter to the outer section breaks free when the filter is installed over the refrigerator's water outlet nipple. I believe the root cause of the problem is a combination of poor filter design (the weak weld geometry) and the slight swelling of the nipple's O-rings that occurs over a period of time as the rubber slowly absorbs a small amount of water. The swollen O-rings cause a high force to be exerted on the filter's weld joint during installation. Through a Venturi action across the broken weld, air gets sucked into the upstream side of the filter element. This element does not easily pass air, thus the reduced flow due to a vapor-lock condition. The hammering occurs as a result of the dynamics of water flow, Venturi action and pressure on the loose inner piece. Eventually enough air gets sucked in to completely cover the inlet surface of the element and prevent any water form passing through.
The fix is twofold: replace the filter, and replace the refrigerator's outlet water nipple. I would apply a thin film of FDA-rated silicone grease to the O-rings of the nipple. This will ease filter insertion and retard swelling of the O-ring from the water.