I got in to an argument with someone about this. I didn't dispute that the government was very important to its success but he called it a "command economy operation" and that seemed to me to be going way too far. My understanding is something like the Roman state operating infrastructure, like keeping the seas free of pirates, but the actual trade itself was handled by merchants and the government became more directly involved when the the grain reached Ostia and then they shipped it to Rome for the grain dole. Am I wrong?
You are both right and wrong in different aspects. Your bud is wrong that it was a "command economy operation," because neither the State nor the Emperor maintained a fleet of ships specifically for the grain dole. There was a fleet, and it DID sometimes participate in the transport of grain, but that was not its true purpose. The vast majority of the grain was transported from Africa and Egypt by "private" ships.
These ships belonged to a gigantic network of seaborne transport, of which wheat transport was only a tiny part, and of which tiny part the State's grain dole was an even tinier part. There were ships crisscrossing the Med every day, carrying every kind of good imaginable, and the whole operation moved under the sophisticated machinery of Roman private enterprise, driven by credit burden and shared risk and commodity prices and so forth.
The dole, under the Republic and Principate both, functioned by State contracts. This is in fact how the State conducted nearly all of its business. The State would issue contracts to bring the required amount of grain to Ostia, the more the better, and those contracts brought with them certain incentives. Individuals or societātēs of merchants (like medieval guilds, but more robust) would bid on the contracts, often time leveraging their own idiosyncratic connections to facilitate the contracts for their own profit. For instance: I might take a State contract to transport grain from Egypt with the knowledge that my ten cousins control an interest in a dock-workers' group in Alexandria. I can get the grain up the Nile and loaded onto ships cheaper than the competition because of these connections, or eliminate a middleman, etc.
So: the State did not just depend on the free market to bring grain to Ostia, and then buy a portion of the haul in bulk. It let out contracts which assured the grain's transport all the way from its source(s). In that way, your friend is right and you are wrong. But there were not Imperial Grain Agency officials who carried this out. The transport was done by trade network, which was inherently "private."
An analogy: if the government of Belgium wanted to import 11.5 million rubber duckies to give to each of her citizens, the State would not go about buying a fleet of cargo ships, the transport cans to put them on, and then hiring crews to sail them. Shipping companies exist for that. Belgium would probably also not go out to find a supplier of the rubber duckies. It would put out a contract and various rubber ducky manufacturers would bid. Some company in China would make a bid at 15 euro cent per ducky, which would beat out the Bangladeshi bid of 55 euro cent per ducky.
Now, in times of crisis, the State could step in to ensure the supply to the City was not drastically interrupted. We hear about Pompey actually sailing from place to place, requisitioning stores of wheat. The Roman Fleet could be employed in this way, though their ships were warships and not properly fitted out to transport huge amounts of grain. These types of situations should be considered emergency measures, wheat martial law, not the norm, and and usual the sources for how exactly these emergency measures were carried out is pretty sketchy. Often it involved price manipulation or subsidizing. Augustus gave everybody on the roster 400 sesterces so that they could afford a temporary price spike. Tiberius put a temporary price cap on wheat in the city and paid the wheat importers a little bonus to soften the blow. Nero did something similar.
Peter Temin (The Roman Market Economy, Princeton UP 2013) has a nice little write-up of the grain dole and the economics behind it, along with some of his lovely charts. He collects all of the major incidents of emergency manipulation, as well.
(Bonus) some of the incentives the Roman state offered for encourage bids on grain dole contracts: citizenship for non-citizen merchants; the right to be exempt from the onerous requirement to have kids; the right to make a will without male interference (if a woman merchant, a merchantress); Hadrian exempted merchants in provincial cities from having to perform compulsory services for their city (I'm not sure what they were asked to do, though); there were also some tax exemptions and/or waiving of harbor dues.
...and one afterthought edit: the grain dole contracts were probably not the most lucrative--hence the incentives. A merchant or societas was probably always better off by doing something else. BUT: many of the major players in the massive machinery of shipping were also major players in elite social life in the Capital, and thus under a certain amount of pressure from the Emperor to do what he wanted. It wasn't all just about profit margins. When Trajan cornered you at a party and said "hey man, next time you send the Isis out, it would please me greatly if at least a portion of your cargo was set aside to transport grain for the wonderful Populus Romanus. They deserve it, don't you think? Ok bud, enjoy the party. Your emperor appreciates you."