The bottoms of most sailboats are painted with antifouling paint
every year or two, regardless of whether they are sailed in fresh or salt water. After many years, those layers of paint
accumulate, just like the paint
on the siding of a wooden-sided house, and the paint
starts to peel. When the underwater surfaces become rough, the boat's performance is severely diminished. Some owners maintain the underwater surfaces of their boats better than others. They might have sanded the bottom each year, to reduce the accumulation of paint, in which case the bottom might be in better condition. If you're really lucky, the previous owner of your boat might have stripped all the old paint off recently. In any case, eventually every boat will need a bottom job.
If you go to a marine service company and ask for a bottom job, they'll ask you what you want them to do. If you want a light sanding of the surface, and one or two coats of antifouling applied, they'll quote you a price for that. If you want the old paint stripped off completely, and two coats of antifouling paint applied. that will cost quite a bit more. If you want the old paint stripped off, 4-5 coats of barrier paint applied, and 2 coats of antifouling applied, then be prepared to pay dearly for that. In short, the extent of the work that needs to be done, and consequently the cost, will depend on the condition of the boat you buy. When you're looking at boats, one that has a smooth bottom is worth more to you than one that has a foul bottom. If the bottom is foul, reduce your offering price, and politely tell the seller why.
The cost of a bottom job is high because both the materials and labor are high, and because it's unpleasant work. Some of us prefer to pay the pros to do the work, and others prefer to save money by doing it ourselves. I stripped my first cruising boat, a Catalina 22, and on my later Catalina 25, I stripped it, applied antifouling and barrier coat, and, although I grumbled about the unpleasantness of it while doing it, I was absolutely thrilled with the boat's performance afterward. I sold that boat and bought a 35' boat, and paid someone to strip the old paint, which was the hardest and most unpleasant part of the job, and then barrier-coated it and applied antifouling myself. Applying paint isn't really very difficult, and you can save alot by doing it yourself.
In any case, we can't tell you how much it'll cost until you know how much work needs to be done. If you buy a boat with a clean bottom, you won't need to worry about it. But, if you buy a boat that needs a bottom job, either do it yourself or have it done. Don't forgo it, because sailing a boat with a foul bottom can be very unsatisfying.