A senator could vote for an infrastructure bill, then buy stock in concrete. Or they could sit on the Armed Services Committee and trade in defense contractors stock.
Lawmakers could vote for infrastructure bill, then buy stock in a concrete firm.
Does the bill specify who they're going to be paying the money to, though? Because an infrastructure bill saying we're going to spend a certain amount of money on these projects can predict changes in certain industries, but being on a committee and saying, "We're going to hire this specific company with this huge government contract to do this work," can tell you exactly what company is about to have a huge boost to their value.
Usually the committee gives the executive branch a sum of money and tells them to find someone to do the job.
Occasionally a specific company is designated by legislators. But this wouldn't be a secret, the committee meetings themselves are open to the public. And likewise when everyone votes on the bill, the name of the company would be public.