Many people do that. Most of them sanitize a container (like an ice cream bucket) and add either boiled water or bottled water to it and then freeze that. You don't want to use commercial ice, because of the chance of contamination. But your own ice from a sanitized container is fine. So, cool the wort a little from boiling (even ice won't completely chill two or three gallons of boiling wort) and then put it in the primary bucket, and add the ice. I'd do it in several different additions, so you don't over cool it. I'd probably freeze 2 or 3 block of a couple of quarts, and then top up the rest with water.
Many use carboys, so you can't do that with a carboy! Also, you can't do that will full boils, so that's why I use a wort chiller.