How long do you want to be in Mauritania for, and is it one-way or return?
A single entry visa costs €10 at the Western Sahara/RIM border and gives you three days to transit the country. It appears you can extend this three days in Nouakchott, search the HUBB for details.
If you are going on to Mali or Sénégal and then want to return you need to get another transit visa and you cannot obtain this on all crossing points. For example, the Diama piste from Sénégal into Mauritania can only be crossed on a multiple entry visa, so you would need to go via Rosso instread. I seem to remember the visa was €20 at Rosso.
"For sheer delight there is nothing like altitude; it gives one the thrill of adventure
and enlarges the world in which you live,"
Irving Mather (1892-1966)
Access the Morocco Knowledgebase