Texas State Bankshares has agreed to buy Estrada Hinojosa & Co., one of the nation's biggest municipal underwriting and advisory firms.