What is black trying to accomplish when playing Bb4 after Nc3 in the opening? This happens sometimes when you're playing a person, more often when playing the computer it seems. The lichess Android app for e.g., on the easiest setting, always follows Nc3 this way (usually following on the first variation below).

[FEN ""]
1. e4 e5 2. Nc3 Bb4 3. a3 ( 3... Bxc3 4. bxc3 Nf6 5. Rb1) (3... Ba5 4. b4 Bb6)  


Every time I see this played I wonder what black is trying to gain here. He either ends exchanging the bishop for my knight (and giving my rook a good open file) or locking his bishop in one corner, neither seems particularly useful.  

Am I missing something?
It is indeed a little silly to play ...Bb4 on move 2 here. That said, it often gets played a little later, and the main idea is to pin the knight on c3 (after the d-pawn has moved), so that it no longer protects the pawn on e4, which can now be attacked by a knight on f6, say.

In the particular line you gave, by the way, the bishop is doing just fine on b6. You spent time kicking it to a place where it's aiming right at the weak pawn on f2 and beyond to your king on g1 once you castle.