So I've been thinking about this a little. I don't have a great idea about it yet but my so far favorite idea is that Coby and Luffy sailed a bit longer together before reaching Shells Town and Luffy really grew on Coby, as Luffy tends to do. So at the end of Shells Town Coby asks to come with them.
It isn't until after Arlong Park that Coby mentions his marine dream to the crew and they encourage him to follow it. We get a Coby centric arc where they stage a massive fight (like the end of Shells Town but make it more dramatic) and Coby says goodbye and gets to join the marines.
He is, however, still part of the crew and sends them info from time to time.
Luffy isn't the kind of captain to care if having a marine as part of your crew is allowed or not, and neither is his crew. They make it work.
(Coby wears a little Strawhat jolly roger patch somewhere on his person at all times)
The East Blue crew keep forgetting to mention that their elusive intel officer (and second mate) is a marine.