Home Improvement Questions? Ask a Handyman for Answers
Welcome to JA!
This is most likely a case of water hammer. It is usually caused from a loose pipe in the wall that bangs against the wood when a fast acting valve closes (toilet fill valve).
The best solution is to open the wall, and secure the pipes.
You can also install a water hammer arrester at the toilet stub out. But unless the pipe are very hard to get to, it is usually best to find where the banging is happening and secure the pipe.
It is okay to use, it is just very annoying. You can run the hot and cold water in the sink until the toilet has finished the cycle, then turn off the water slowly, this should stop the hammer.
Worst case scenario is the pipe would bang so hard it would break the pipe, This is NOT likely.
Depends on how hard the pipes are to get to, I think you will have a plumber costs of about 1 hour, (150.00) sheet rock repair possibly, (250.00) and maybe install a new fill valve in the toilet. (85.00) So the cost could range from 300.00 to 600.00 depending on your labor rates in your area.
You are welcome, thank you for using Just Answer!