I will travel from Frankfurt to Berlin by ICE and I wanted to ask if there is Wi-Fi in the trains and how much does it cost?
It's available on most ICE routes, but not all.
Cost wise there it's 4,95€ a day in standard class, though there's a small number of roaming partners with whom you can get online in standard class too (mostly T-Mobile Germany though). It used to be paid-for in first class as well, but as of late 2014, it's now free for first class customers (matching what most other European high speed operators do for their wifi).
DB has a page in English that lists the current routes it's available on, and have a pdf map. (Note that the English language map and pages are older than the German ones!). I believe that as of 2015, most of the major routes should offer it. A (possibly incomplete) list of where it's available, as given on their website, is: