How are GA aircraft ferried from factories?
As you've guessed, there are two options: a ferry flight, or shipping the aircraft in a container.

Ferry flights are quite common; the recent Cirrus ditching in the Pacific was a ferry flight to Hawaii. As well as planning a suitable route and dealing with permits and paperwork, refueling etc., the ferry company may install extra fuel tanks to give more range, and provide the pilot with specialized survival and communications gear. And an airline ticket home, of course :-) This might all seem expensive, but considering that a new top-of-the-range Cirrus SR22 has a list price of almost USD 800,000 you can imagine that ferry costs aren't necessarily a big deal in comparison.

The second option is to put the aircraft in a container and ship it, and there are some companies who specialize in this (the page has some small photos of aircraft in containers). The major concern in this case is removing the wings: gliders and many experimental (e.g. home-built) aircraft are designed to have their wings removed for storage and transportation (towing behind your car) but most typical Cessnas, Beechcraft etc. aren't. You need to have the aircraft professionally and carefully prepared and then re-assembled and checked after delivery.

Which option is best depends on the costs of each option and the value of the aircraft. There's also the consideration that if you buy a 60-year old aircraft from the other side of the world, ferry companies may decline to fly it to you because of the risks of subjecting it to the stresses and weather of a very long series of flights. Or their/your insurance company may refuse cover for a ferry flight for the same reason. Or perhaps the aircraft is certified for VFR only, which would make a long ferry journey much more difficult to plan and execute. In those cases, container shipping may be the only available option.