Most ambassadors, of course, are foreign service officers, but often the posts involving the most important bilateral relations (such as with Great Britain, Japan and India) or desirable locales (such as the Bahamas) are given to close friends and well-heeled contributors of the president.
I had always just thought of this is a kind of casual, widely accepted corruption. But recently I did learn the official story as to why this is good practice, namely that an important political supporter or a friend of the president is likely to have a much easier time of getting access to the Oval Office than any mere foreign service officer would. Thus, it’s arguably better for the host country to have a political appointee than a career FSO. Therefore, this practice helps build good-will and so forth.
Not sure I buy that, or even that the person who explained it to me buys it, but that’s the story.