What is the difference between transistor BC107 and 2N3904
If you look at the datasheets for the 2N3904 and BC107, the main specs to look for are:

            2N3904       BC107
max Vceo      40V         45V            (collector-emitter voltage)
max Vcbo      60V         50V            (collector-base voltage)
max Vebo       6V          6V            (emitter-base voltage)
max Ic       200mA       200mA           (collector current continuous)
max Icbo      50nA        15nA           (current collector cutoff)
max Pd       625mW       600mW           (power dissipation)
max Vce(sat) 0.2V *     0.25V **         (collector-emitter saturation)
                                           * @Ic=10mA, Ib=1mA
                                          ** @Ic=10mA, Ib=0.5mA
min Ft       300 MHz *   150 MHz **      (switching frequency)
                                           * @Ic=10mA, Vce=20V, f=100 MHz
                                          ** @Ic=10mA, Vce=5V, f=100 MHz
min Hfe β    100 *       110 **          (DC current gain)
                                           * @Ic=2mA, Vce=10V
                                          ** @Ic=1mA, Vce=5V


So as you can see, most of the specifications are nearly the same.  Some specs, such as V\$\small_{CE}\$(sat), f\$\small_{T}\$ and H\$\small_{FE}\$ are specified under certain test conditions, which are not exactly the same for both transistors.  The minimum switching frequency supported by the 2N3904 is about double that of the BC107.  Unless you are running at very high speeds, the two BJTs should be interchangeable.

Digi-Key uses I\$\small_{C}\$, V\$\small_{CEO}\$, V\$\small_{CE}\$(sat), I\$\small_{CBO}\$, h\$\small_{FE}\$, P\$\small_{D}\$, and f\$\small_{T}\$ as parameters in its selection tool.

As far as costs go, the 2N3904 is a very popular transistor, manufactured in many millions per year.  The BC107 is much less common.  Digi-Key currently has over 400,000 of the through-hole 2N3904 in stock and ready to ship at 18¢ (12 Rs.) apiece for singles or as low as 3¢ (2 Rs.) in quantity, but has only 830 of the BC107 at $1.91 (127 Rs.) apiece, or as low as 91¢ (60 Rs.) in quantity.  So you got a really good deal on the BC107s at Rs. 15.

The prices of the surface-mount version of the 2N3904 at Digi-key are about the same as the through-hole, and they have 110,000 of those ready to ship.  As far as I know, there isn't a surface mount version of the BC107, due to lack of demand.

In addition to the savings afforded by volume, the 2N3904 is manufactured in a plastic TO-92 case, whereas the ZBC107 is made in a metal TO-18 can, which would be much more expensive to make: