Midwives funded and trained by a milk formula company have been offering advice to Tesco customers in a pilot programme criticised as "unethical".