Overland Park-based Sprint Corp. is nearing an agreement on the price, capital structure and termination fee of an acquisition for T-Mobile US Inc. that could value the wireless carrier at almost $40 a share, people with knowledge of the matter said. T-Mobile’s equity value would be about $31 billion. The agreement could be announced as soon as July, the people said. A deal would bring together the third- and fourth-largest U.S. wireless carriers to create a more formidable competitor to leaders AT&T Inc. and Verizon Communications Inc. The companies haven’t set an announcement date, and there’s still a lot of work to be done before a deal is completed, including deciding management of the new entity.