This is mostly luck but there's some badassity, too.
We've had problems for a few years with tree roots blocking the main sewer line out of our house. We've always just had a service come and clear it out and it works again for a year or two.
It finally got to the point where we were going to have to dig & replace the pipe. We made an appointment for the same service to run a camera down to examine the roots & pinpoint the problem. They were convinced that the main line went towards the front of the house to the street. DH thought it went to the property line in the back yard. DH started digging in the back yard, hoping to save some money when we actually hired someone. (This is the badassity part.)
DH called the city to confirm the pipe location (he was right, BTW) & he explained that we're going to send a camera down. The awesome guy from the city told DH to send him the video & if the root ball was near the joint where our pipe hits the city's pipe, the city would do the work for free! (This is the lucky part.)
We got the video, DH sent it to awesome guy, and they came within a week or two, dug down (5 or 6 feet) to the pipe, replaced it, had it inspected, and put the dirt back. All at no cost to us (well, propertay taxes, I guess).
We never got an estimate for having the work done but I think it would have been at least a couple thousand, based on what others have told me. I think the city does the work to ensure that we (or the people we hire) don't mess up the city's pipe and that the work gets inspected.