You're talking about nearly every open source CMS out there (permissions, templates, etc.) combined with OpenX (formerly OpenAds, formerly PHPAds New).
Look at Joomla, Drupal, MODx...
Go here to review just about every open source CMS under the sun...
http://www.opensourcecms.com/
Go here to do side by side comparisons of their features...
http://www.cmsmatrix.org/
Pricing will vary greatly depending on the features you want. A customized CMS can cost anywhere from low $X,XXX to mid/high $XXX,XXX. It all depends on what you want and who you get to build it.