Banking giant UBS is acquiring its smaller rival in a $3 billion deal negotiated by the Swiss government.