We consider a dynamic, stochastic extension to the transportation problem. For the deterministic problem, there are known necessary and sufficient conditions under which a greedy algorithm achieves the optimal solution. We define a distribution-free type of optimality and provide analogous necessary and sufficient conditions under which a greedy policy achieves this type of optimality in the dynamic, stochastic setting. These results are used to prove that a greedy algorithm is optimal when planning a type of air traffic management initiative. We also provide weaker conditions under which it is possible to strengthen an existing policy. These results can be applied to the problem of matching passengers with drivers in an on-demand taxi service. They specify conditions under which a passenger and driver should not be left unassigned.