Back in 2000 when I built my house, the local power company wanted $27,000 to run approx. 1/4 mile of line to my house. I had the option of above ground which included poles, but I had to clear 40' either side of the poles myself through very dense woods. I decided to go the underground route right down the center of my drive.
I told the power company I would run the lines myself as I had priced the line and materials needed and came up with a price of around $8,000. They said I couldn't do it myself and when I asked why they didn't really have an answer. I waited 4 months while their legal teams tried to come up with a reason and eventually got approval to do my own install minus final hookup. The power company actually sold me the materials (cable, transformer, connectors etc.) for several thousand less than I could've purchased them from a private source.
I got an acquaintance of mine to dig my trench with his backhoe (including refilling the hole after the line was buried) for $1000. It took extra time because the power company insisted on inspecting my trench to ensure it was the proper depth before I could drop my line, and they dragged their feet sending out an inspector, I'm guessing because they weren't happy with me doing it myself. After I got the lines buried, they sent a crew out to set my transformer and do the final hookups at my house and the pole which they set right next to my neighbors.
When all was said and done, I paid just over $7000 for everything. Then the kicker was I had to sell it back to the power company for $1 or else they wouldn't maintain it in the event of lightning strikes, power surges or whatever other problems might arise. I still lose power occasionally during severe storms (I have a backup generator) but I'm the only one in the area with underground. Up to the point where it hooks to my pole it's all above so until that changes I'll always have to deal with storm issues.