BERLIN (Reuters) - Chancellor Angela Merkel's cabinet is expected to approve a measure on Wednesday to close a tax loophole used by foreign companies operating in Germany, according to legislation drafted by finance ministry and viewed by Reuters on Monday.

The legislation, which would still need approval by the German parliament, is expected to take effect from 2018 and result in 30 million euros in additional income for German federal, state and local governments, according to the draft.

The legislation calls for tightening rules that allow deduction of certain internal expenses to discourage firms from transferring patents, licenses, concessions and market rights to other countries that either apply low taxes or none at all.

Germany's move comes amid efforts by the Group of 20 industrialized countries and the Organization for Economic Cooperation and Development (OCED) to combat licensing and patent loopholes.

(Reporting by Gernot Heller,; Writing by Andrea Shalal)