The cost depends on a variety of factors. For railways, DC traction is simpler and easy to implement for relatively short routes. That' why DC is typically used for suburban, metros and short distance routes.
In this case, the news article is somewhat incomplete. Morocco currently has a 3KV DC network, but it will be upgraded to 25KV AC in future. The locos received by ONCF will work on DC for now, but have sufficient room to be modified for working with 25KV AC if necessary.