A historic hotel in a popular Scottish tourist town has been sold.