Buy-or-sell deal when there is cash shortage
Let's assume $A$ stated that the company is worth $P$.

I propose the following mechanism:

$B$ has to choose one of two alternatives:


Sell his share for $bP$.
Pay an amount of his choice, $x\leq aP$, and then with probability $\frac{bP+x}{P}$ get $A$'s share and with probability $1-\frac{bP+x}{P}=\frac{aP-x}{P}$ lose his own share (in addition to paying $x$).


If $B$ thinks that the company is worth less than $P$, he should go with the first option, just like in the original scheme.

Otherwise he should pick the second alternative, paying as much as he can to maximize his profit expectation. Should $B$ have enough money, he would pay $aP$ and get $A$'s share w.p. 1, if not, there is no way of allowing $B$ to get the company without ripping $A$, unless this is done randomly..