I'm going to assume you've been doing the /. equivalent of living under a rock, since this question comes up (and gets answered) every single time this topic is discussed, and that's a lot. But what the hell...
Landing on solid ground is, generally, preferable. However, unlike the ocean where you can tell all the boats to get out of a safety zone, land has these inconvenient things like buildings and infrastructure that can't simply be told to stay away for their own safety. Until it was clear how precisely SpaceX could bring the rocket down - and remember, we're talking about something returning from the edge of space, at supersonic speeds, with barely any fuel remaining, in a maneuver that had never been attempted before - it would have been foolish to bring the rocket down anywhere near any inhabited regions. Given the geography around the launch sites they use, that means the ocean is the best bet by far.
Also, sometimes they may not have a choice. The rocket *really* doesn't have a lot of fuel left as it returns, and it's going really, really fast in a direction that is decidedly away from the launch site (but not fast enough to make it all the way around the world, or the second stage wouldn't be needed to actually achieve orbital velocity). SpaceX pulls a lot of cool tricks to guide the rocket's return, like using the stage as a lifting surface (with a truly abysmal lift/drag ratio, I assume, but they're also trying to scrub speed) while controlling it with little folding grid fins (which are quite effective at those speeds). However, at the end of the day, even Falcon 9 may not have the fuel margin to return to the spaceport after launches even though it has enough fuel to launch *somewhere*. The center core of the Falcon Heavy - which flies for much longer than the F9 first stage - will be much too far downrange to boost back to the spaceport in most cases. Thus, for FH's center core, the barge may be the only landing option. Landing on a ship may be harder than landing at a conventional spaceport, but the ship can be almost anywhere there's ocean, while land-based spaceports are not noted for their mobility.
Now, with all that said, the goal is to, eventually, be able to land at the spaceport. The next F9 launch after this one will, according to a cool site called SpaceX Stats, attempt to return to the launch site and land there. This presumably demonstrates that SpaceX has been found to have sufficient precision in the first-stage landing attempts so far for it to be safe to land near people and expensive buildings. I wish them the very best of luck!