Buying a used sailboat can be a very smart decision. Just as with new cars versus used cars, a "pre-owned" sailboat can offer better value for the money than buying a new sailboat. But unless you yourself are an expert in surveying boats, the cost of a professional marine survey of the vessel prior to purchase is almost always a good investment.
A comprehensive inspection by a professional marine surveyor of the sailboat you're considering can uncover a host of problems that your own closest inspection wouldn't reveal. The surveyor goes through a comprehensive survey checklist, and also performs additional inspection as needed, based on his years of experience inspecting all types of boats. Minor problems can provide you with a negotiating platform for getting the boat for a better price. Major problems may cause you to decide not to purchase the boat, or at least to insist on a professional repair prior to purchase, paid for by the seller.
The smaller and less expensive the boat, the less necessary a survey is, but with larger sailboats, particularly vessels that are more than a few years old, you should consider a boat survey as a routine part of the cost of buying the boat, just as a professional home inspection is part of the cost of buying a home.
Marine surveys are typically paid for by the buyer — you, as the buyer of the boat, want the surveyor to have a fiduciary responsibility to you, rather than to the seller. Commonly, an offer is made on the baot contingent upon a satisfactory survey (and often contingent upon a sea trial, as well). After the seller accepts the offer, the survey is performed, paid for by you, the buyer. Most surveyors include inspection of the hull and bottom if the boat is hauled out of the water (also paid for by the buyer).
After the survey is completed, the surveyor will provide you with a marine survey report: a comprehensive list of all the things wrong with the boat. At that point, you can make an informed decision about whether you still want to purchase the boat, and whether you want to negotiate for any price concessions or repairs from the seller.