A pair of SoHo apartment buildings dating back to the turn of the 20th century has sold for $18 million.