JLeslie
Once the person forms the specific intent to steal and takes some affirmative act exercising control over the goods the crime is complete. Contrary to popular belief, in most states this is so even if the goods have not been removed from the store. Saying you are sorry later and offering to pay for it do not erase the criminal act, even if the confession and surrender of the goods is completely voluntary. The strict application of the law in this area is very harsh. So, yes, someone can be legally prosecuted in the situation you describe.
Having said that, my personal opinion is that prosecution under those circumstances is extremely poor judgment by the store owner, the police, and the prosecutor. Not every criminal act has to result in a criminal charge. There is an area where discretion can be exercised and the situation you describe certainly called for that.
The whole subject of retail theft, detentions, prosecutions, and penalties is, to me at least, a fascinating one. There are about 5,000 people in the US arrested every day for shoplifting, and my understanding is that does not even count the ones who are detained and let go with a civil demand and a warning not to return to the store. In essence there is an entire shadow world out there, manned largely by an unregulated private police force – store loss prevention personnel – and most people are almost completely unaware of it, even though they brush past it in their daily lives.