First of all, was the damage repaired before you bought the car limited to just the rear bumper?
If you rear ended in your recent accident and the rear bumper was damaged at all, the proper procedure would be to replace the rear bumper cover (at minimum). The bumper cover is the part you see of the rear bumper, starting behind the rear wheel, extending across the back of the car around the the back edge of the wheel well on the other side. Damaged bumper covers can't be properly repaired, so I would demand replacement!
There are two main parts underneath the bumper cover that may have also been damaged. The 'Reinforcement' is actually the part that is bolted onto the car and supports the bumper structure. In between the 'Reinforcement' and Bumper Cover is a part called the 'Energy Absorber'. Depending on the speed and angle of the hit, any or all of these components may be damaged and require replacement.
A new bumper cover lists for about $404, Energy Absorber is $118 and Reinforcement is $201, for Genuine Mazda Parts. The bumper cover has to be painted to match the vehicle.
I would contact the General Manager (usually the top-level manager at the dealership) and let him know the situation. Explain that you were NOT pleased to learn that your car had been damaged prior to being sold to you, but it was not disclosed. You spent $23-25k+ on a car and you were purchasing a brand new car in brand new condition. Between the at-fault driver's insurance company and the body shop at his dealership, you expect the problem to be corrected when you pick it up from the shop!
Be sure to tell him that his own body shop employee as well as another body shop professional has verified that there was prior damage to the vehicle. If you get no response, tell them you will be contacting an attorney to explore your legal options.
I hope this helps! Good luck! BTW, after this is over, don't EVER go back to that dealership again!!! I love my Mazda ('06 Mazda6 5-door) but I have had several bad experiences with Mazda dealers....