Question: Is there any difference between *there was an increase of 2%* and “there was an increase by 2%”?

Answer: 
"Increase" is being used as a verb in the phrase "increase by 2%". This makes the second sentence incorrect (because it already has the verb "is").

"Increase" is being used as a noun in the phrase "increase of 2%", and this makes sense because it is being used as a direct object in the first sentence.
In your example, "increase" is a noun. So here are your options (in bold):

There can be an increase:

(i) **of** a certain amount

(ii) **of** something that has grown larger

(iii) **in** something used a means of measurement, e.g. size, temperature, etc.

(iv) **in** something being measured statistically

(v) **from** a lower amount **to** a higher amount

(vi) **over** or **on** an earlier amount or the period when that earlier amount was calculated

(c) *A Valency Dictionary of English* (2004)

As you can see, \**an increase by* is not idiomatic English ("unnatural for a normal Englishman to say or write").