If the DoJ ultimately won the case, then it's fair that Apple should have to pay their legal costs.
But since using a 200 year old law to force Apple to do work they don't want to do was a legal stretch, if the DoJ lost the case then again I'd say the DoJ should pay Apple's legal costs.