Your description of being "allowed" to do research work in exchange for programming work sounds off to me. Learning and running experiments for a research project proposed by a supervisor is basically the job description of a research assistant. It's work in its own right that people are typically compensated for in some way, not a reward for doing other (programming) work.
The arrangement you describe is not common, and it might also violate U.S. labor law. Under U.S. law, it's illegal to let someone work for you for free unless they meet specific legal requirements to be considered a "volunteer" or "intern."
"Volunteers" according to U.S. labor law are individuals
who volunteer their time, freely and without anticipation of compensation for religious, charitable, civic, or humanitarian purposes to non-profit organizations.
Your intent is clearly not religious, charitable, civic, or humanitarian in nature, so you do not legally qualify as a volunteer.
And to be classified as an "intern" you must meet the requirement that
The employer that provides the training derives no immediate advantage from the activities of the intern; and on occasion its operations may actually be impeded.
(among other requirements). That is, the employer cannot expect to be dependent on your work for normal operations. I don't think you meet the requirements for an unpaid intern, though it's not possible to be 100% sure from your description.
The usual interpretation of the U.S. labor law is that an internship has to be part of a formal educational program (e.g., you are enrolled as a student and get credits for the internship, or write a report which you submit to your home institution) or a formal apprenticeship for it to be legally unpaid. In fact, if you search for unpaid internships in the U.S., you'll find that most listings say that only current students who can earn college credit are eligible. It doesn't say in your post that you are currently enrolled as a student somewhere.
This is not to say that there is no legal scenario in which a U.S. lab can allow you to participate in research there without paying you. (If the entire experience was supposed to be for your educational benefit - including the "help the lab with programming their machines" part - then my answer might be different.) But from your description, I don't think the scenario you describe is acceptable or normal.
I personally do not allow anybody to do work for my lab unless they are paid or doing a personal project (like a thesis) for which they earn academic credit. I've been told it would be legally problematic. For example: suppose I have an M.S. student working with me for academic credit. He graduates in May and has a job starting in September. I'm not allowed to let him keep working in the lab from May-September unless I can pay him (according to my university lawyers).
(Disclaimer: I am not a lawyer)