A Chevy Chase medical office building that's been in the same hands for more than 50 years has sold for $40.1 million.