Say Alice and Bob have a shared secret $s$.
Alice and Bob establish an encrypted channel and verify that it hasn't been MitM'ed by exchanging $r_1$ and $r_2$, where $r_1$ and $r_2$ are randomly generated by Bob and Alice respectively and sent over the channel. Alice computes $\operatorname{HMAC}(C \mathbin\| r_1, s)$ and Bob computes $\operatorname{HMAC}(C\mathbin\|r_2, s)$ where $C = \operatorname{HASH}(\text{Communication-channel})$ and they exchange values:
A & B: $C = \operatorname{HASH}(\text{Communication-channel})$
A → B: $r_1$, $\operatorname{HMAC}(C \mathbin\| r_1, s)$,
B → A: $r_2$, $\operatorname{HMAC}(C \mathbin\| r_2, s)$A & B recalculate $\operatorname{HMAC}(C \mathbin\| r_2, s)$ and $\operatorname{HMAC}(C \mathbin\| r_1, s)$ and verify that they match the received values.
At this point Alice should trust that Bob knows $s$ and has the same value of $C$, and vice versa. If Eve had carried out a MITM attack on the channel, the HMACs would fail, because $C$ would be different for Alice and Bob.
What differences would there be if the socialist millionaire protocol was used to establish that $s$ is shared?