This problem can be solved by the solution of "chicken and rabbit in the same cage", assuming that all of them are sold at 40%, you can earn more. What is extra is to calculate 20% as 40%, so that the cost price of A can be calculated, and then the cost price of B can be calculated.
Formula: (2700*40%-840)/(40%-20%)
=( 1080-840)/20%
=240/20%
= 1200 (yuan)
2700- 1200= 1500 (yuan)
A: The cost price of A is 1200 yuan, and the cost price of B is 1500 yuan.