A former Bank of America technology consultant used his access to the bank's internal deal tracking system to share more than 50 trading tips with friends, who generated more than $5 million in illegal trading profits, federal prosecutors said.

The worker, Daniel Rivas, "serially misappropriated material, non-public information from the bank's deal tracking system and passed it along to friends so they could utilize it to make profitable trades," according to an indictment unsealed Wednesday by the U.S. District Court of the Southern District of New York.

Prosecutors laid out 54 insider trading charges against five of Rivas' acquaintances in the indictment. Rivas pleaded guilty on Aug. 9. The U.S. Securities and Exchange Commission announced its own insider trading charges against Rivas, and six other individuals on Wednesday.

The trades were in more than two dozen securities, including AstraZeneca, St. Jude Medical, Monsanto, Cabela's, Diamond Resorts International, Panera Bread, Macy's and LifeLock, the indictment said.

"We fired Mr. Rivas in April and cooperated fully with the government's investigation into this matter," Bank of America said in a statement to CNBC.

Rivas went on to work at RBC and has since been suspended pending further review, according to a statement from the bank.

An attorney for Rivas did not immediately respond to a CNBC request for comment.

Rivas worked at Bank of America for about four years, and he had access to the firm's system containing "material, non-public information about potential and unannounced merger and acquisition transactions," the U.S. indictment said.

He shared trading tips with his girlfriend's father, James Moodhe, and with two separate groups of friends. Moodhe also allegedly shared the inside information with Michael Siva, a financial advisor at a brokerage firm, who traded for himself and clients based on the trading tips. Moodhe was named in the SEC charges. Silva was named in both the federal indictment and the SEC case.

Moodhe and Siva tried to cover up their tracks by making it appear that Siva directed the trades, the indictment said.

One of their most profitable illegal trades was around AstraZeneca's Nov. 2015 tender offer acquisition of ZS Pharma. Moodhe and Siva together purchased nearly 30,000 shares, sold out after the news was made public, and took in nearly $600,000 in illegal gains, the indictment said.

In total, Siva and Moodhe generated profits of more than $3 million, according to the indictment, and Siva also earned thousands of dollars in commissions on illegal trades entered on behalf of his clients.

Rivas also allegedly shared insider information with friends Roberto Rodriguez and Rodolfo Sablon, who planned to set up an investment fund trading on the tips. They were both named in the indictment and the SEC case.

Two others charged in both cases were Jhonatan Zoquier, a union representative, and Jeffrey Rogiers, a computer and network security analyst who received tips.

The individuals also allegedly shared the information with other people, who also made profitable trades, the indictment said.

— With reporting by CNBC's Jim Forkin.