You can do it yourself. See USCG National Vessel Documentation Center, Home Page
It can be a bit daunting and time consuming. The documentation services can help smooth the experience but they, of course, charge a fee over and above what the Coast Guard charges. I have worked with some of them and most are very helpful. It just depends on whether you have the time and patience or would rather have someone else deal with it.
If you are buying a used boat that is already documented it gets easier. If you buy a used boat that has never been documented, insist that the seller have all the paperwork in order, and know who the previous owners are because you are going to have document the history of ownership, all the way back to the builder. Specifically ask for a (this form has several names) a Builder's certificate, or Certificate of Origin, Or Manufacturers Statement of Origin. If the boat was document previously the seller should have Form CG 1261 Builders Certificate. http://uscg.mil/hq/cg5/nvdc/forms/cg1261.pdf
Plus you will need a Bill Of Sale (there's a CG form for that too) and a completed Simplified Measurement Application (CG-5397)
Anyway, discuss this with the seller of any boat you may be interested in. If they have documented their boat they will know what it's like. If they haven't a clue then maybe you should think it over.